Skip to main content

Running Locally

You may notice that running via Docker is relatively slow. The preferred way to address this is to use docker-sync to speed things up. Another approach is to get all the dependencies and run things locally.

There's 3 major runtimes we use:

  • TypeScript: all the production code is in TypeScript
  • Go: the CLI and orchestration
  • Python: For the database migrations. We use the Alembic framework.

Here's the steps to install locally:

  • Install golang version of 1.22.0
  • Get the latest version of the Ent CLI:
go install github.com/lolopinto/ent/tsent@v0.0.43
python3 -m pip install auto_schema==0.0.26
  • Install the following TypeScript packages globally:
npm install -g typescript@5.3.2 prettier@3.1.0 ts-node@11.0.0-beta.1 @swc/core@1.3.100 @swc/cli@0.1.63 @biomejs/biome@1.4.1
  • Install tsconfig-paths and @swc-node/register locally:
npm install --save-dev tsconfig-paths@4.2.0 @swc-node/register@1.6.8
  • Install rg

If on OSX, the command is:

brew install ripgrep

For different OSes, check out github for installation instructions.

You should now have everything you need to run locally.

You'd need to check this page regularly in case one of the dependencies has changed.

Check out the CLI to see what the supported commands are.

When running locally, we have to pass the database connection to the CLI, there are two ways to do this:

DB_CONNECTION_STRING

Env variable DB_CONNECTION_STRING . Run as follows:

  DB_CONNECTION_STRING=postgres://ola:@localhost/ent-starter tsent codegen

Note the change from host.docker.internal in docker-compose.dev.yml from the ent-starter repository to localhost .

config/database.yml

To specify the database connection parts, can put the details in a yml file: config/database.yml

config/database.yml
dialect: postgres
database: ent-starter
user: ola
password: ''
host: localhost
port: 5432
pool: 5
sslmode: disable

Run as follows:

  tsent codegen