Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions apps/docs/docs/overview/first-steps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
id: first-steps
title: First steps to start working with the Stack
sidebar_label: First Steps
---

# Quick Start
This article will help you quickly start the PWA and API to begin working on it.

- After cloning the source code on your computer, go to the repository root
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if we want to add a note about the fact that some of the packages are private for the moment and that an npm authentication is required to use them.

- Install all dependencies by running `npm install`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a note about the fact that the --force flag is often (always?) needed for the installation ?

- Run `docker-compose up -d`. You may need to delete docker volumes for this command to work
- Sync your local database with its prisma schema, run `npm run prisma:db:push` and to populate the database run `npm run prisma:db:seed`
- Start the api by running `nx run api:serve`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a note about the fact that nx must be installed globally to run this command ? Also, another way to run it without a globally installed nx is with npm run nx run api:serve =)

- In a new terminal, start the PWA by running `nx run pwa:serve`, by default you can access the PWA at http://localhost:4200
17 changes: 8 additions & 9 deletions apps/docs/docs/overview/project-initialisation.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ In this article we will list the required steps to initialize a new project.
of this is mandatory.
- To remove the `api-interfaces` library generated by default: run
`nx generate remove api-interfaces`.
- Update the generated `.gitignore` with the tractr `.gitinore`.
- Update the generated `.gitignore` with the tractr `.gitignore`.

## Add hapify to the project

Expand All @@ -43,8 +43,7 @@ In this article we will list the required steps to initialize a new project.

- Run `npm install -D @nx-plus/docusaurus` to install docusaurus packages.
- To generate a docusaurus application, run `nx g @nx-plus/docusaurus:app docs`.
- Test if the generated app works with `nx serve docs`. If an error occure, it's
maybe a webpack problem. Try to install `npm i -D webpack@5`.
- Test if the generated app works with `nx serve docs`. If an error occurs, it may be a webpack issue. Try to install `npm i -D webpack@5`.

## Add prisma and create a `prisma` library in the workspace

Expand Down Expand Up @@ -73,22 +72,22 @@ In this article we will list the required steps to initialize a new project.
- Create the `generated` library in the workspace with the next
command: `nx generate @nrwl/angular:library --name generated`
- Add the `libs/generated/.hapifyrc.js`file to the lirbrary.
- Install the packages containing the hapifyt templates:
- Install the packages containing the hapify templates:
`npm i -D @tractr/hapify-templates-casl @tractr/hapify-templates-models @tractr/hapify-templates-rest-dtos @tractr/hapify-templates-nestjs-models @tractr/hapify-templates-nestjs-models-common @tractr/hapify-templates-nestjs-models-rest @tractr/hapify-templates-rext-client @tractr/hapify-templates-angular-rext-client --force`.
- Edit `workspace.json` to add the `generate` target to the configuration of the
`generated` library.
- Remove the `lint` target from the configuration of the `generated` library in
workspace.json as it is not used.
- Now you should be able to run`npm run generate`. It should generate a lot of
- Now you should be able to run `npm run generate`. It should generate a lot of
files in `libs/generated/generated`.
- Update typescript path in workspace.json
from`@cali/generated": ["libs/generated/src/index.ts"]`to`"@cali/generated/_": ["libs/generated/generated/_"]`.
- Remove the useless `.gitkeep` files (in `libs` and `apps`).

## Initialise the `api` application

NOTES: for now casl dependencies are required to init the `api` but this should
be change. the next dependencies must be installed:
NOTES: as of now casl dependencies are required to init the `api` but this should
be changed. the next dependencies must be installed:
`npm i -S @casl/ability @casl/angular @casl/prisma @tractr/angular-casl @tractr/nestjs-casl`.

- Update nestjs packages from v7 to v8: `ncu --filter @nestjs/* -u`
Expand All @@ -99,11 +98,11 @@ be change. the next dependencies must be installed:
- In `workspace.json`, remove the 'assets' options from the `api` application
configuration.
- Update `apps/api/src/main.ts` with the tractr version.
- Update `apps/api/src/app/app.module.ts` with tractr version.
- Update `apps/api/src/app/app.module.ts` with the tractr version.
- Add a `docker-compose.yml` file at the root of the workspace, to host the
database container.
- Add a `.env.example` and a `.env` file at the root the workspace to host
environment variables. NOTE: check tha `.env` is in `.gitignore.
environment variables. NOTE: check that `.env` is in `.gitignore.


## Development tools and continuous integration
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"postinstall": "(is-ci || husky install) && ngcc --properties es2015 browser module main && npm run generate",
"prisma:db:push": "prisma db push --schema=./libs/prisma/prisma/schema.prisma",
"prisma:db:seed": "prisma db seed --preview-feature --schema=./libs/prisma/prisma/schema.prisma",
"prisma:studio": "prisma studio --schema=./libs/prisma/prisma/schema.prisma",
"start": "nx serve",
"test": " nx run-many --all --target=test",
"ts-node": "ts-node -r tsconfig-paths/register --project apps/api/tsconfig.json",
Expand Down