Developer Docs

C# Local Environment Setup

Prerequisites

The steps in this article are to be carried out after an app has been created and cloned to your local environment.

Software Downloads

Required Software

Database

By default, an app made with Codebots will use a PostgreSQL database. If your application was created using the Generate tool, and you specified a database other than the default (Postgres), use the database provider you selected instead.

If you are setting up a new database provider, all Codebots’ applications default to username: user and password: pass when trying to connect.

If you are using an existing database provider, you can configure your database connection by altering the connection string in serverside/src/appsettings.Development.xml.

You do not need to create the database for the server at this stage - it will be created later.

First time setup

It is important to note that if these steps are being done on Linux, you should not sudo these commands, or otherwise there shall be file ownership issues later.

  1. First the client-side needs to have its packages installed; navigate to the clientside directory and run npm install -g yarn followed by yarn install.
  2. Navigate to serverside/src/ and run dotnet build.
  3. An initial database migration must be created; navigate to serverside/src and run dotnet ef migrations add InitialMigration.
  4. Now the migration needs to be applied to the database; still in the serverside/src directory, run dotnet ef database update. This will create the database and all of the tables.
  5. At this point the server should be ready to run; still in the serverside/src directory, run dotnet run.
  6. You can now access the server by navigating to http://localhost:5000/ in your web browser.

Configuration

IDE

By default an sln file is not created, but this can be fixed from the dotnet command line.

Now the sln file can be opened in an IDE such as Visual Studio or Rider.