mirror of
https://github.com/xlorepdarkhelm/numinar-coding-project.git
synced 2026-09-06 00:48:26 -04:00
64 lines
2.6 KiB
Markdown
64 lines
2.6 KiB
Markdown
# Online Booking Application
|
|
|
|
## Cliff Hill's Coding Project
|
|
|
|
This is a full-stack application simulating an online booking system for conference rooms.
|
|
|
|
### AI Use
|
|
|
|
I used AI to stub out a couple of files:
|
|
|
|
- The backend/Dockerfile and frontend/Dockerfile - to speed up the process of getting docker loaded efficiently for the project.
|
|
- The compose.yml file - getting the different images gathered together quickly.
|
|
- The compose.dev.yml file - used to get a further understanding of how to hook up an extension to the previous file.
|
|
- The mermaid diagrams used in this file.
|
|
- I have the CodeGPT plugin in VSCode, and it has helped with docstrings, logging messages, and sometimes reducing the time it takes me to write out the code.
|
|
|
|
### Running for production
|
|
|
|
The standard docker compose file is used to set up the project in the production environment, and can be run from the following command:
|
|
|
|
```bash
|
|
docker compose up
|
|
```
|
|
|
|
In this mode, only one port is exposed in docker - the port 3000, which is the frontend. Postgres and the backend ports are hidden.
|
|
|
|
### Local running
|
|
|
|
There is an alternative compose file specifically designed for running this project locally which allows for real-time editing and updating of either the frontend or backend components. The command ro tun everything locally is:
|
|
|
|
```bash
|
|
docker compose -f compose.dev.yml up
|
|
```
|
|
|
|
This compose file extends the standard compose file, adding in the necessary pieces to make the application usable in a local dev environment. In this configuration, the frontend is accessable from port 3000 like normal, the backend is accessable from port 8000, and postgres DB from 5432. The way this is set up, that command can easily be run in a separate terminal window during development for rapid testing of the piece(s) being worked on. Logging is at Debug level, and SQLAlchemy is set to echo mode, so queries are also logged. Realtime changes are reflected in the application as the code is run, and commands can be run locally from your terminal (like alembic) without needing to shell into the docker image.
|
|
|
|
### Diagrams
|
|
|
|
Docker Compose Components:
|
|
|
|
```mermaid
|
|
graph TD
|
|
A[Frontend] -->|HTTP/REST| B[Backend]
|
|
B -->|SQL| C[Postgres]
|
|
A -->|Docker Network| B
|
|
B -->|Docker Network| C
|
|
```
|
|
|
|
Backend Request Data Path:
|
|
|
|
```mermaid
|
|
graph TD
|
|
A[Frontend Request] -->|HTTP Request| B{FastAPI Router}
|
|
B -->|Matches Route| C[API Endpoint]
|
|
C -->|Input Validation| D[Pydantic Schema]
|
|
D -->|Validated Data| E[Service Layer]
|
|
E -->|Business Logic| F[Model]
|
|
F -->|DB Operations| G[Database]
|
|
G -->|Query Result| F
|
|
F -->|Processed Data| E
|
|
E -->|Response Data| C
|
|
C -->|HTTP Response| A
|
|
```
|