Simple Insurance Policy Management System
This guide explains how to set up and run the application in three different environments: Production, Local, and Development.
- Docker installed on your machine.
- Node.js and Angular CLI installed.
- An IDE like Visual Studio Code or Rider to run the .NET API.
- .NET SDK installed.
These 2 instructions will get your app up and running locally.
The production setup can be fully Dockerized or partially Dockerized with the Angular client deployed through an external service.
- Run the Application:
ENABLE_SSL=true docker compose up -d
Note
Only include the ENABLE_SSL ARG if you have the certificat.pfx at /home/user/certs/
And password certssl
You can also modify those props in the docker compose file.
If you'd like to generate the pfx:
dotnet dev-certs https --clean
dotnet dev-certs https -ep ~/certs/certificate.pfx -p certssl --trust
- Access the Application:
- App: Your host mapped to http://localhost:8080
- pgAdmin: Your host mapped to http://localhost:8888
- Use
postgres
as the host when connecting to the database.
- Use
-
Run the API and Database: Navigate to the API folder and run:
docker compose up -d
-
Deploy the Angular Client: Deploy the Angular build files to a service like AWS Amplify, which uses S3 and CloudFront for hosting.
-
Access the Application:
- App: Accessible via the Amplify-provided URL.
- pgAdmin: Your host mapped to http://localhost:8888
- Use
postgres
as the host when connecting to the database.
- Use
The local setup is similar to the fully Dockerized production setup but uses a different build configuration.
-
Build the Docker Image with Local Configuration:
DEPLOY_LOCAL=true docker compose up -d
-
Access the Application:
- App: http://localhost:8080
- pgAdmin: http://localhost:8888
- Use
postgres
as the host when connecting to the database.
- Use
Run Database Migrations: While in the root project directory, run migrations with:
docker compose run --rm ef-migrate dotnet ef database update -- --environment Production
The development setup involves running services through Docker Compose and running the code locally.
-
Start the Database and pgAdmin: Run the following command in the API folder:
docker compose -f docker-compose-dev.yml up -d
- pgAdmin: Accessible at http://localhost:8889.
- Database Connection Info:
- Host:
localhost
- Port:
5432
- Host:
-
Run the API: Use your IDE or the .NET CLI to start the API:
dotnet run
The API will handle migrations automatically when it starts.
-
Run the Angular Client: Navigate to the Angular project folder and run:
npm install ng serve
- The app will be accessible at http://localhost:4200.
The application uses the following environment variables for the database setup:
Variable | Default Value | Description |
---|---|---|
POSTGRES_USER |
insured |
The username for the database. |
POSTGRES_PASSWORD |
iP@2025 |
The password for the database user. |
PGADMIN_DEFAULT_EMAIL |
[email protected] |
The email for the pgadmin. |
PGADMIN_DEFAULT_PASSWORD |
a@dmIn3.. |
The password for pgadmin. |
POSTGRES_DB |
insurancedb |
The name of the database. |
Note: These values can be overridden in the docker-compose
file or by setting them in your environment.
Environment | Access App | Access pgAdmin | Database Host | Notes |
---|---|---|---|---|
Prod (Docker) | Prod URL | Prod URL | postgres (via pgAdmin only) |
Fully Dockerized setup. |
Prod (Hybrid) | Amplify URL | http://localhost:8888 | postgres (via pgAdmin only) |
API & DB in Docker; Angular on S3/CloudFront. |
Local | http://localhost:8080 | http://localhost:8888 | postgres (via pgAdmin only) |
Similar to prod but with DEPLOY_LOCAL=true . |
Dev | http://localhost:4200 | http://localhost:8889 | localhost:5432 |
DB & pgAdmin in Docker, API & client run locally. |