unloop-connect v1.12.1
Unloop
Contents
Technology Stack
Setup
This setup requires that you have Docker and Docker Compose installed on your your system.
For MacOS and Windows users, you should only need to install Docker Desktop. Docker Desktop includes both Docker Engine and Docker Compose.
For Linux users, you have to separetely install Docker and Docker Compose. You can follow this guide.
1. Initialize containers with Docker Compose
Once you clone this repository to your local machine, run the docker-compose command below to spin up the containers:
docker-compose up
If you are running Linux, you might need to run the command above with sudo:
sudo docker-compose up
The application should now be running on:
http://localhost
When you make a change to the client or server files, the respective Docker containers running will recompile automatically. In other words, hot-reloading is enabled.
2. Database migration with Knex CLI
A migration needs to take place in order to create the necessary database tables for the application to work.
If you want to learn more about how migrations work with Knex CLI, you can give this part of the Knex documentation a read.
To run the migrations, you would need to enter the backend/api container:
docker exec -it unloop-api-service sh
Once you are inside the container, you can run:
npx knex migrate:latest --knexfile=./src/knexfile.js
Or use the package script
npm run db:migrate
3. Database seeder with Knex CLI
Now that you have the database tables created, it's time to seed them with data.
Make sure that you are still inside the container from step 2. To run all seeders, you can run:
npx knex seed:run --knexfile=./src/knexfile.js
Or use the package script
npm run db:seed
That's it! The application should be fully running now.
4. Set up Postgres GUI tool with pgAdmin/TablePlus (optional)
If you want to manage the database with a GUI, pgAdmin/TablePlus is the way to go. You can download them here link (pgAdmin)/link (TablePlus).
Once you install pgAdmin, you can add the database server with the following credentials:
- Host name/address: localhost
- Port: 5432
- Maintenance database: postgres
- Username: postgres
- Password: postgres_password
Maildev
Since we don't have a specific domain purchased just yet, we're utilizing a Maildev for now.
The all emails send by the sendEmail utility will be received in Maildev running on localhost:8080