You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+186Lines changed: 186 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -793,6 +793,192 @@ npm run dev
793
793
794
794
---
795
795
796
+
## 🐳 Docker Setup
797
+
798
+
The project includes a complete Docker setup with hot reload for both frontend and backend, making it easy to run the entire application with a single command.
799
+
800
+
### Prerequisites
801
+
802
+
-**Docker** and **Docker Compose** installed
803
+
-**`.env` file** created in the root directory (see setup below)
804
+
805
+
### Quick Start
806
+
807
+
1.**Create a `.env` file** in the root directory of the project.
808
+
809
+
**Option A: Copy from `appsettings.development.json`**
810
+
811
+
If you already have `server/appsettings.development.json` configured, you can create the `.env` file by converting the JSON structure to environment variables. Use double underscores (`__`) for nested configuration keys.
812
+
813
+
**Option B: Create manually**
814
+
815
+
The `.env` file should contain all environment variables matching the structure of `server/appsettings.development.json`. Use double underscores (`__`) for nested configuration keys.
- The `.env` file is already in `.gitignore` and will not be committed to the repository
859
+
- Variable names use `__` (double underscore) for nested configuration (e.g., `ConnectionStrings__Default`, `Jwt__Issuer`)
860
+
- Copy values from `server/appsettings.development.json` and convert the JSON structure to environment variable format
861
+
- For nested objects, use `__` to separate levels (e.g., `App__VerificationCodeExpiration__EmailVerificationMinutes`)
862
+
863
+
2.**Start all services** with Docker Compose:
864
+
865
+
```bash
866
+
docker-compose up
867
+
```
868
+
869
+
This will:
870
+
871
+
- Build and start both frontend and backend services
872
+
- Enable hot reload for both services (changes are reflected immediately)
873
+
- Expose frontend on http://localhost:3001
874
+
- Expose backend on http://localhost:3000
875
+
- Automatically run database migrations on backend startup
876
+
- Load all environment variables from the `.env` file
877
+
878
+
### Services
879
+
880
+
#### Backend (ASP.NET Core)
881
+
882
+
-**Port**: 3000
883
+
-**Hot Reload**: Enabled via `dotnet watch`
884
+
-**Environment**: Development
885
+
-**Database**: Automatically runs migrations on startup
886
+
-**Swagger**: Available at http://localhost:3000/swagger
887
+
888
+
#### Frontend (Next.js)
889
+
890
+
-**Port**: 3001
891
+
-**Hot Reload**: Enabled via Next.js dev mode
892
+
-**API URL**: http://localhost:3000/api
893
+
894
+
### Docker Commands
895
+
896
+
```bash
897
+
# Start services
898
+
docker-compose up
899
+
900
+
# Start in detached mode (background)
901
+
docker-compose up -d
902
+
903
+
# Stop services
904
+
docker-compose down
905
+
906
+
# Rebuild after dependency changes
907
+
docker-compose build
908
+
docker-compose up
909
+
910
+
# View logs
911
+
docker-compose logs -f
912
+
913
+
# View logs for specific service
914
+
docker-compose logs -f backend
915
+
docker-compose logs -f frontend
916
+
```
917
+
918
+
### Hot Reload
919
+
920
+
Both services support hot reload out of the box:
921
+
922
+
-**Backend**: Changes to `.cs` files automatically trigger `dotnet watch` to rebuild and restart
923
+
-**Frontend**: Changes to `.tsx`, `.ts`, and `.css` files are automatically reflected in the browser
924
+
925
+
Source code is mounted as volumes, so you can edit files directly and see changes immediately.
926
+
927
+
### Environment Variables
928
+
929
+
All environment variables are loaded from the `.env` file in the root directory. The `docker-compose.yml` uses `env_file: - .env` to automatically load all variables into both services.
930
+
931
+
**Key Points:**
932
+
933
+
- The `.env` file must be created in the root directory (same level as `docker-compose.yml`)
934
+
- Variable names must match the structure of `appsettings.development.json` using `__` for nesting
935
+
- The `.env` file is already in `.gitignore` and will not be committed to the repository
936
+
- Both backend and frontend services read from the same `.env` file
937
+
- Environment variables override `appsettings.development.json` when set
938
+
939
+
**Converting from `appsettings.development.json` to `.env`:**
0 commit comments