.Net without manager in a local dev environment

  • Objective:
    In my company we are aiming to deploy our own server, following the docker compose guide or the local development environment guide posted on the documentation page.
    Once we achieve that, I need confirmation whether the only thing that i will need to change in the following code is the url using my local server url:
namespace SpeckleSampleApp
{
  class Program
  {
    static void Main(string[] args)
    {
      var account = new Account();
      account.token = "YOUR-PERSONAL-ACCESS-TOKEN";
      account.serverInfo = new ServerInfo
      {
        url = "https://app.speckle.systems/"
      };

      var client = new Client(account);
      var stream = client.StreamGet("5dfbeb49c9").Result;
    }
  }
}

I’m also a little confused about the token variable since I have requested it using the speckle server frontend app. Is it fine if I keep using the same one?

The other question I have is whether I would be able to visualize the projects created programmatically in my own server in the speckle server frontend app dashboard?

best regards.

For your token, See this guide on how to generate one.

When you generate the token, you are prompted to select scopes, you’ll probably want to select most stream and user scopes.

I recommend using AccountManager.GetServerInfo and AccountManager.GetUserInfo static functions to fetch the ServerInfo and UserInfo, rather than trying to create them manually. Some SDK functions will expect complete user and server information.

i.e.

static async void Main(string[] args)
{
    Uri serverUrl = new("http://localhost"); //change this to your server url
    const string authToken = "YOUR-PERSONAL-ACCESS-TOKEN"; //change this to your personal access token
    
    var account = new Account();
    account.token = authToken; 
    account.serverInfo = await AccountManager.GetServerInfo(serverUrl);
    account.userInfo = await AccountManager.GetUserInfo(authToken, serverUrl);

Yep, you can continue to use this token indefinitely, it will remain active unless you revoke it (either via the frontend, or GraphQL),


Absolutely, projects created programmatically will appear in your own server’s frontend.

e.g.

using var client = new Client(account);

var projectCreateArgs = new ProjectCreateInput("My Project", "My Project Description", ProjectVisibility.Unlisted);
var project = await client.Project.Create(projectCreateArgs);

Wow, that looks quite sophisticated. I’m just curious, how does the frontend app is able to display the projects or models that were programmatically created using a custom url instead of the default one:
url = “https://app.speckle.systems/

is that entirely handled by speckle?? or is there any particular section in the following guide:

that aids to maintain that connection?

if what you mentioned is true, then I don’t think I have any blockers for this week hehe :smiley:

Your projects created using your custom server will not be accessible from app.speckle.systems
They’ll be accessible from your own frontend url.

The speckle-frontend-2 in your dockerfile will be hosting a frontend (you may need to check but i believe the ingress service routs this to port 80)

Your self hosted server is completely independant from app.speckle.systems

1 Like

It’s also worth me mentioning incase you were thinking you needed to avoid using manager. This is not the case, you can use Manager to authenticate accounts for your custom server. you just need to specify your custom server url while adding the account.

This should be a bit easier than the manual auth via token we’ve discussed since you can fetch accounts via the various functions in AccountManager

If you plan on using other speckle connectors you’ll likley want to do this method.

1 Like