Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
c35c008
Removing one line script
SafetyInObscurity Nov 13, 2025
54802cc
replaced poetry with superior package manager
samjjacko Nov 13, 2025
d0cdd6a
updated readme
samjjacko Nov 13, 2025
7e541b2
modified backend workflow to check uv is behaving itself
samjjacko Nov 13, 2025
eb389d3
whoops
samjjacko Nov 13, 2025
a4b09f2
Added coverage and removed pip install coverage from workflow (lol)
samjjacko Nov 13, 2025
e4ff46e
edit eslint config
laurenpudz Nov 18, 2025
aac747b
add ignores
laurenpudz Nov 19, 2025
c09ee1b
fixed stuff
samjjacko Nov 20, 2025
f5b0cec
pull devcontainer image from use_uv branch from automated_setups
samjjacko Nov 20, 2025
2c9f21c
Forgot to remove password validation
samjjacko Nov 20, 2025
29edb3b
Use correct package (whoops)
samjjacko Nov 20, 2025
d09f675
minor improvements
samjjacko Nov 20, 2025
9c6d79a
dev.sh doesn't exist
samjjacko Nov 20, 2025
1503c3f
fixed docker-compose.prod.yml
samjjacko Nov 20, 2025
c08d15c
Fixed ci, github actions, and (hopefully) future production builds on…
samjjacko Nov 21, 2025
6d920f9
uv setup improvements, removed flake and replaced with ruff.
bendog Nov 26, 2025
12880c1
added .editorconfig
bendog Nov 26, 2025
d0b8057
updated github actions for uv
bendog Nov 26, 2025
303cb77
ruff formatting updates for server
bendog Nov 26, 2025
d822b7f
updated server Docker to use uv too
bendog Nov 26, 2025
9d94075
add psycopg back
bendog Nov 29, 2025
93de239
fixed next.config
bendog Nov 29, 2025
6caebc5
added ruff to dev packages
bendog Nov 29, 2025
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
9 changes: 5 additions & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
"name": "CFC - Devenv",
// You can get the sha256 here https://github.com/codersforcauses/automated-setups/pkgs/container/cfc-devenv
// Pin it to a specific version to avoid unnecessary breaking changes
"image": "ghcr.io/codersforcauses/cfc-devenv@sha256:18a25d3859e743e192e20f0d57ddc0d364c7397c9372d087025414d89d2ee66b",
"image": "ghcr.io/codersforcauses/cfc-devenv-uv@sha256:1450f1ff8be623b5b1f0e00728381af8efb1182e54ef8bbeaa447c7762abb29f",

"features": {},

// Use this environment variable if you need to bind mount your local source code into a new container.
// Authenticate with GitHub Container Registry
"remoteEnv": {
"WORKSPACE_FOLDER": "${workspaceFolder}"
"WORKSPACE_FOLDER": "${containerWorkspaceFolder}",
// so we don't have to go looking for it
"UV_CACHE_DIR": "${containerWorkspaceFolder}/.uv-cache"
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [3000, 8000, 5432],

Expand Down
4 changes: 2 additions & 2 deletions .devcontainer/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fi
(cd server && mkdir -p static)

# Install dependencies
(cd server && POETRY_VIRTUALENVS_CREATE=false poetry install)
(cd server && uv sync)
(cd client && npm install)

# Run the database in the background
Expand All @@ -37,4 +37,4 @@ until [ "$(docker inspect -f '{{.State.Health.Status}}' "$DB_CONTAINER_ID")" ==
done

# Nuke and migrate db
(cd server && ./nuke.sh)
(cd server && uv run ./nuke.sh)
57 changes: 57 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

# python files
[*.py]
trim_trailing_whitespace = true

# config files
[*.{json,json5,yaml,yml,toml}]
indent_size = 2

# Javascript and Typescript
[*.{js,jsx,ts,tsx,vue}]
indent_size = 2
block_comment_start = /**
block_comment = *
block_comment_end = */

# HTML and CSS
[*.{htm,html,css,sass,scss,less,svg}]
indent_size = 2

# Terraform
[*.{tf,tfvars}]
indent_size = 2

# Shell scripts
[*.{sh,bat.tpl,Makefile.tpl}]
indent_style = tab

# Makefiles
[Makefile]
indent_style = tab

# windows scripts
[*.{cmd,bat}]
end_of_line = crlf

# Markdown
[*.md]
trim_trailing_whitespace = false
indent_style = space
indent_size = 2

# diff files
[*.diff]
trim_trailing_whitespace = false
4 changes: 2 additions & 2 deletions .github/workflows/cd-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: Build and Push Docker Images

on:
push:
branches: [main]
branches: [use_uv]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
IMAGE_NAME: ${{ github.repository }}-${{ github.ref_name }}

jobs:
build-and-push-client:
Expand Down
50 changes: 20 additions & 30 deletions .github/workflows/ci-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,31 @@ name: Backend code checks

on:
push:
branches: [main]
branches: [use_uv]
pull_request:
types: ["opened", "synchronize", "reopened", "edited"]
workflow_dispatch:

jobs:
lint:
name: Run Flake8
name: Run linting
runs-on: ubuntu-latest
defaults:
run:
working-directory: server
steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v5

- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: get ruff
uses: astral-sh/ruff-action@v3

- name: "Install flake8"
run: pip install flake8
- name: ruff check
run: ruff check

- name: "Install flake8-django"
run: pip install flake8-django
- name: ruff format check
run: ruff format --check

- name: "Run flake8"
uses: liskin/gh-problem-matcher-wrap@v1
with:
linters: flake8
run: flake8 --max-line-length 150 server/
build:
name: Build and test
runs-on: ubuntu-latest
Expand All @@ -51,19 +48,13 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v5

- name: Install poetry
run: pipx install poetry

- name: Set up Python Env
uses: actions/setup-python@v4
with:
python-version: "3.12"
cache: "poetry"
- name: Install uv
uses: astral-sh/setup-uv@v6

- name: Install dependencies 👨🏻‍💻
run: poetry install
run: uv sync --frozen --all-groups

- name: Run Migrations 🕊️
env:
Expand All @@ -73,7 +64,7 @@ jobs:
POSTGRES_PORT: 5432
EMAIL_PORT: 1025
FRONTEND_URL: http://localhost:3000
run: poetry run python manage.py migrate
run: uv run python manage.py migrate

- name: Run tests 🧪
env:
Expand All @@ -85,9 +76,8 @@ jobs:
EMAIL_PORT: 1025
FRONTEND_URL: http://localhost:3000
run: |
poetry run python3 -m pip install coverage
poetry run coverage run manage.py test
poetry run coverage xml
uv run coverage run manage.py test
uv run coverage xml

- name: Upload Coverage ☂️
uses: codecov/codecov-action@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Frontend code checks

on:
push:
branches: [main]
branches: [use_uv]
pull_request:
types: ["opened", "synchronize", "reopened", "edited"]
workflow_dispatch:
Expand Down
28 changes: 0 additions & 28 deletions .github/workflows/template-sync.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ celerybeat.pid
.env.local
.env
.venv
.uv-cache
env/
venv/
ENV/
Expand Down
83 changes: 18 additions & 65 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,10 @@ Django + Nextjs Template: Standardised CFC Tech Stack

---

## Quick Start (Dev Container) - Recommended

The easiest way to get started is using the VS Code Dev Container:

1. **Prerequisites**:
- [Docker Desktop](https://www.docker.com/products/docker-desktop/)
- [VS Code](https://code.visualstudio.com/)
- [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)

2. **Open in Dev Container**:
- Clone this repository
- Open the project in VS Code
- When prompted, click "Reopen in Container" or use `Ctrl+Shift+P` → "Dev Containers: Reopen in Container"

3. **Start the application**:
```bash
# Terminal 1: Start the frontend
cd client && npm run dev

# Terminal 2: Start the backend
cd server && python manage.py runserver
```

4. **Access the application**:
- Frontend: [http://localhost:3000](http://localhost:3000)
- Backend API: [http://localhost:8000](http://localhost:8000)
- Admin panel: [http://localhost:8000/admin](http://localhost:8000/admin)

---
## Local Development Setup

**Note**: Only follow these steps if you're NOT using the dev container.

### Prerequisites

- **Node.js 18+** and **npm** - [Download here](https://nodejs.org/)
- **Python 3.12+** - [Download here](https://python.org/)
- **Poetry** (Python package manager) - [Installation guide](https://python-poetry.org/docs/#installation)
- **Docker Desktop** - [Download here](https://www.docker.com/products/docker-desktop/)
- **uv 0.8+** (Python package manager) - [Installation guide](https://docs.astral.sh/uv/getting-started/installation/)

### Installation Steps

Expand All @@ -53,29 +18,31 @@ cd <project-name>
```

#### 2. Install Prerequisites

**Poetry (Python package manager)**
**MacOS:**
```bash
# Official installer (all OSes)
curl -sSL https://install.python-poetry.org | python3 -

# If that fails, use pip (all OSes)
pip install poetry
brew install uv
```

#### 3. Start the Database

**Ubuntu**
```bash
cd server && docker compose up -d
apt install astral-uv
```

#### 4. Set Up Environment Variables

Otherwise, look at the [installation guide](https://docs.astral.sh/uv/getting-started/installation/)
#### 3. Set Up Environment Variables
Before proceeding, create your environment files by copying the examples:
```bash
cp ./client/.env.example ./client/.env && cp ./server/.env.example ./server/.env
```

#### 4. Set Up the Backend (Django)
```bash
cd server
uv sync
source .venv/bin/activate
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver
```

**Backend (`.env` in `server/`)**
```env
APP_NAME=DjangoAPI
Expand All @@ -101,16 +68,6 @@ FRONTEND_URL=http://localhost:3000
NEXT_PUBLIC_BACKEND_URL=http://localhost:8000
```

#### 5. Set Up the Backend (Django)
```bash
cd server
poetry install
poetry shell
python manage.py migrate
python manage.py createsuperuser # optional
python manage.py runserver
```

#### 6. Set Up the Frontend (Next.js)
```bash
cd client
Expand Down Expand Up @@ -197,11 +154,7 @@ If you run into migration conflicts that you can't be bothered to fix, run `nuke

### Update Dependencies

You can run `npm install` and `poetry install` in the respective `client` and `server` folders to install the newest dependencies.

### Editing Docker stuff

If you modify anything in the `docker` folder, you need to add the `--build` flag or Docker won't give you the latest changes.
You can run `npm install` and `uv sync` in the respective `client` and `server` folders to install the newest dependencies.

### Changing env vars

Expand Down
Loading