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
- Ensure using project's Node version:
$ nvm use
- Confirm you are using the correct Node version:
$ node -v # You should see `v16.8.0`
- 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 againIf you want to start from scratch, please stop any running containers, and then run the following:$ npm run db:migration:run
Now you can return to the beginning of this step and start over.$ npm run db:reset:hard
- Start the application:
$ npm run dev
- Navigate: http://localhost:3000
You should be able to see the 'login' page, but will not be able to actually create an account.
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