The Seso-app repo supports Seso Labor's web server, client application, and other services.
- Clone the repository:
$ git clone [email protected]:sesolabor/seso-interview-prep-repo.git
- Install dependencies:
$ npm install
- Start database services:
$ docker-compose up
- If your first time, initialize local database:
Note: if you see 'error : database "seso" does not exist', it may be due to an existing Postgres process running on port 5432. To fix this, stop your running containers and then see if any processes are listed when you run:
$ npm run db:init
If so, remove them ($ sudo lsof -i :5432
brew services stop postgresql
orkill -9 <PID>
) and then run the migration again$ db:migration:run
- Start the application:
$ npm run dev
- Navigate: http://localhost:3000
The project follows the spirit of Domain Driven Design. Top-level nouns being: Entities, Repositories, and Services.
├── server.ts # Routes and bootup stuff.
│
├── pages # Handlers.
│
├── services # Business logic.
│
├── repositories # Repositories & Entities. Think 'single responsibility'.
│
├── client-state # Redux tooling, sagas, ducks.
│
├── components # React components.
Entities are TypeORM Entities. Creating/updating entities, requires migrations! To generate and run migrations, follow these steps:
-
Generating a new entity:
$ npm run typeorm -- entity:create -n User > [email protected] typeorm /Users/wiski/projects/seso-app > ts-node ./node_modules/typeorm/cli --config repositories/ormconfig.ts "entity:create" "-n" "User" Entity /Users/wiski/projects/seso-app/repositories/entities/User.ts has been created successfully.
-
Adding/changing attributes to the entity.
-
Generating a new migration:
$ npm run typeorm -- migration:generate -n CreateUser
-
Running the resulting migration:
$ npm run typeorm -- migration:run