You need to set up your development environment before you can do anything.
Install Node.js and NPM
brew install node
choco install nodejs
Install yarn globally
yarn global add yarn
Install a POSTGRES database.
If you work with a mac, we recommend to use homebrew for the installation.
Then copy the .env.example
file and rename it to .env
. In this file you have to add your database connection information.
Create a new database with the name you have in your .env
-file.
Then setup your application environment.
yarn run dev
This installs all dependencies with yarn. After that it migrates the database and seeds some test data into it. So after that your development environment is ready to use.
Go to the project dir and start your app with this yarn script.
yarn run dev
This starts a local server using
nodemon
, which will watch for any file changes and will restart the server according to these changes. The server address will be displayed to you ashttp://0.0.0.0:3000
.
All script are defined in the package-scripts.js
file, but the most important ones are listed here.
yarn install
yarn start lint
. This runs tslint.lint
.yarn start test
(There is also a vscode task for this called test
).yarn start test.integration
.yarn start test.e2e
.yarn run dev
to start nodemon with ts-node, to serve the app.http://0.0.0.0:3000
yarn run build
to generated all JavaScript files from the TypeScript sources (There is also a vscode task for this called build
).dist
use yarn run dev
.To debug your code run yarn start build
or hit cmd + b to build your app.
Then, just set a breakpoint and hit F5 in your Visual Studio Code.
In this repository, we have the following folder structure
Route | Description |
---|---|
/src | Source folder ot the repository |
/src/--tests-- | All project's tests are written here |
/src/assets | All project's assets are stored here |
/src/constants | All project's constants like axios global configurations are stored here |
/src/styles | All project's styles are added here |
/src/views | All project's pages are added here |
/src/models | All re-usable components models are coded in this folder |
/src/app.js | Entry point of the project dom implementation |
/src/main.jsx | Entry point of the project dom implementation |
vite.config.js | React Dom renderer |
tailwind.config.js | Edit tailwind css configurations in this file |
postcss.config.js | Works the same as tailwind.config.js |
cypress.json | Configurations of cypress testing module |
index.js | Example entity endpoint |
Before you start, make sure you have a recent version of Docker installed
docker build -t <your-image-name> .
The port which runs your application inside Docker container is either configured as PORT
property in your .env
configuration file or passed to Docker container via environment variable PORT
. Default port is 3000
.
docker run -d -p <port-on-host>:<port-inside-docker-container> <your-image-name>
docker run -i -t -p <port-on-host>:<port-inside-docker-container> <your-image-name>
docker stop <container-id>
You can get a list of all running Docker container and its ids by following command
docker images
Go to console and press
There are several options to configure your app inside a Docker container
You can use .env
file in project root folder which will be copied inside Docker image. If you want to change a property inside .env
you have to rebuild your Docker image.
You can also change app configuration by passing environment variables via docker run
option -e
or --env
.
docker run --env DB_HOST=localhost -e DB_PORT=3306
Last but not least you can pass a config file to docker run
.
docker run --env-file ./env.list
env.list
example:
# this is a comment
DB_TYPE=mysql
DB_HOST=localhost
DB_PORT=3306