Small Ionic PWA app with NestJS/MongoDB backend
- Registration and Login (JWT)
- List of air quality measurements by user city (part of the user profile)
- List of all air quality measurements by country/city (desc sort by air quality index)
- PWA support
- List infinite scroll
- Create account (all fields are required - city will be used for filtering)
- Login
- Home page shows two tabs:
- My list: This is the list of measurements filtered by city name from user profile (see step 1)
- All: This is the list of all measurements grouped by country/city and sorted by index
Project supports docker and it can be started using docker-compose
:
cd Src/
docker-compose build
- First time start only db service and add initial data
docker-compose up air-quality-db
- When the container is running we need to add our inital user:
- Open container bash:
docker container exec -it air-mongodb bash
- Open mongo:
mongo
- Switch to db
use air_quality
- Add user:
db.createUser({user: 'air_quality_api', pwd: YOUR_PASSWORD, roles: [{role: 'readWrite', db: 'air_quality'}]})
- Exit the mongo shell and container bash
- Open container bash:
- Restore DB dump (DB dump can be found under
Src/db/dump
folder):mongorestore -h localhost:27017 __PATH_TO_PROJECT__/Src/db/dump/
- This will create two collections:
air-quality-indexes
with 15 countries + each country has 25 measurements (subdocuments)users
with default user that can be used for login (username: [email protected], pass: 1234aQ)
- When the database is populated stop the container (Do not delete the container because no volume is configured)
- Set ENV vars and run all services:
sudo JWT_SECRET="" DB_USER="air_quality_api" DB_PASS="" docker-compose up -d
:- Frontend http://localhost:8081 (Use pre-defined demo username:
[email protected]
and password:1234aQ
) - Backend http://localhost:3000
- Both parts, frontend and backend, support configuration with ENV vars (provided with docker-compose - see above).
- Frontend http://localhost:8081 (Use pre-defined demo username: