Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,20 @@

# production
/build
/dist
*/dist

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
.env
*/.env

npm-debug.log*
yarn-debug.log*
yarn-error.log*

*.tsbuildinfo
*.tsbuildinfo
*/bin
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "always"
}
},
"git.ignoreLimitWarning": true
}
81 changes: 18 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,70 +1,25 @@
# Getting Started with Create React App
### How to run the frontend

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
1. `cd frontend`
2. `npm run dev`

## Available Scripts
### How to connect to the DB in Docker

In the project directory, you can run:
1. `cd backend`
2. `docker compose up db backend`
3. Go to the DB tab in VSCode and connect with these credentials:

### `npm start`
- Port: 5435
- Host: localhost
- Username: see `.env` file
- Password: see `.env` file
- Database: see `.env` file

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
### How to run a DB migration

The page will reload when you make changes.\
You may also see any lint errors in the console.
(apply changes that you made in `schema.prisma`, representing changes to the DB tables):

### `npm test`

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can't go back!**

If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.

You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).

### Code Splitting

This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)

### Analyzing the Bundle Size

This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)

### Making a Progressive Web App

This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)

### Advanced Configuration

This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)

### Deployment

This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)

### `npm run build` fails to minify

This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
1. `cd backend`
2. `docker compose exec backend sh`
3. `npx prisma migrate dev --name name_of_migration`
4. The generated `PrismaClient` will be automatically re-generated (see https://www.prisma.io/docs/orm/prisma-migrate/workflows/development-and-production#create-and-apply-migrations)
8 changes: 8 additions & 0 deletions backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules
npm-debug.log*
.env
.git
.gitignore
dist
coverage
*.tsbuildinfo
16 changes: 16 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:22-alpine

WORKDIR /app

COPY package*.json ./
RUN npm ci

COPY prisma ./prisma
COPY prisma.config.ts ./
ENV DATABASE_URL="postgresql://placeholder:placeholder@localhost:5432/placeholder?schema=public"
RUN npx prisma generate

COPY . .

EXPOSE 3000
EXPOSE 5555
61 changes: 61 additions & 0 deletions backend/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
services:
db:
image: postgres:16-alpine
container_name: einbuergerungstest-db
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
ports:
- "${LOCAL_POSTGRES_PORT}:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 5s
timeout: 5s
retries: 10

backend:
build:
context: .
dockerfile: Dockerfile
container_name: einbuergerungstest-backend
restart: unless-stopped
depends_on:
db:
condition: service_healthy
environment:
PORT: 3000
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}?schema=public
TSC_WATCHFILE: FixedPollingInterval
TSC_WATCHDIRECTORY: FixedPollingInterval
volumes:
- ./:/app
- /app/node_modules
ports:
- "${BACKEND_PORT:-3000}:3000"
command: ["npm", "run", "dev:docker"]

prisma-studio:
build:
context: .
dockerfile: Dockerfile
container_name: einbuergerungstest-prisma-studio
restart: unless-stopped
depends_on:
db:
condition: service_healthy
environment:
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5435/${POSTGRES_DB}?schema=public
volumes:
- ./:/app
- /app/node_modules
ports:
- "5555:5555"
command:
["npx", "prisma", "studio", "--hostname", "0.0.0.0", "--port", "5555"]

volumes:
postgres_data:
Loading