feat: set up monorepo scaffold with Yarn workspaces, Django API, React/Vite web, and Docker Compose

- Root package.json with Yarn workspaces (web, api)
- /web: React 19 + Vite 6 + @vitejs/plugin-react
  - index.html, src/main.jsx, src/App.jsx, vite.config.js
- /api: Django 5.x managed with uv
  - pyproject.toml with Django + psycopg2-binary
  - project/settings.py with PostgreSQL config from DATABASE_URL
  - project/urls.py, project/wsgi.py, manage.py
- docker-compose.yml with db (postgres:15), api, web services
  - Health check for db, live code volumes, dependency ordering
- Dockerfiles for both web (node:20-alpine) and api (python:3.12-slim)
- .gitignore updated for Python build artifacts and venv
- docs/implementation-issue-1-monorepo-scaffold.md
This commit is contained in:
Marko (Hermes Implementer)
2026-05-24 07:38:14 +00:00
parent f66c919dbb
commit b91b7c364e
19 changed files with 708 additions and 0 deletions
+78
View File
@@ -0,0 +1,78 @@
import os
from pathlib import Path
BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = os.environ.get(
"DJANGO_SECRET_KEY",
"django-insecure-change-me-in-production",
)
DEBUG = os.environ.get("DJANGO_DEBUG", "True").lower() in ("true", "1", "yes")
ALLOWED_HOSTS: list[str] = ["*"]
INSTALLED_APPS = [
"django.contrib.contenttypes",
"django.contrib.auth",
]
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]
ROOT_URLCONF = "project.urls"
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
"django.template.context_processors.debug",
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
],
},
},
]
WSGI_APPLICATION = "project.wsgi.application"
# Parse DATABASE_URL
_database_url = os.environ.get(
"DATABASE_URL",
"postgres://jobtracker:jobtracker@localhost:5432/jobtracker",
)
# postgres://user:password@host:port/dbname → django settings dict
_db_parts = _database_url.replace("postgres://", "").split("@")
_credentials, _host_db = _db_parts[0], _db_parts[1]
_db_user, _db_pass = _credentials.split(":")
_host_port, _db_name = _host_db.split("/")
_db_host = _host_port.split(":")[0]
_db_port = _host_port.split(":")[1] if ":" in _host_port else "5432"
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
"NAME": _db_name,
"USER": _db_user,
"PASSWORD": _db_pass,
"HOST": _db_host,
"PORT": _db_port,
}
}
LANGUAGE_CODE = "en-us"
TIME_ZONE = "UTC"
USE_I18N = True
USE_TZ = True
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"