These commands should be executed from packages/twenty-server folder.
From any other folder you can run npx nx <command> twenty-server
(or npx nx run twenty-server:<command>
).
npx nx database:reset twenty-server # setup the database with dev seeds
npx nx run twenty-server:start
npx nx run twenty-server:lint # pass --fix to fix lint errors
npx nx run twenty-server:test:unit # run unit tests
npx nx run twenty-server:test:integration # run integration tests
Note : you can run npx nx run twenty-server:test:integration:with-db-reset
in case you need to reset the database before running the integration tests.
If you want to reset the database, you can run the following command:
npx nx run twenty-server:database:reset
npx nx run twenty-server:typeorm --migration:generate src/database/typeorm/metadata/migrations/nameOfYourMigration -d src/database/typeorm/metadata/metadata.datasource.ts # replace by core data source if necessary
There are no migrations files, migration are generated automatically for each workspace, stored in the database, and applied with this command
npx nx run twenty-server:command workspace:sync-metadata -f
This will drop the database and re-run the migrations and seed.
Make sure to back up any data you want to keep before running this command.
Twenty primarily uses NestJS for the backend.
Prisma was the first ORM we used. But in order to allow users to create custom fields and custom objects, a lower-level made more sense as we need to have fine-grained control. The project now uses TypeORM.
Here's what the tech stack now looks like.
Core
Database
Third-party integrations
Testing
Tooling
Development
As an open-source company, we welcome contributions through Github. Help us keep it up-to-date, accurate, and easy to understand by getting involved and sharing your ideas!