Initial commit: Complete project-bootstrap tool
- Bootstrap script for creating monorepo projects - FastAPI backend templates with uv, ruff, mypy, pytest - React frontend templates with TypeScript, ESLint, Prettier - Docker Compose setup with backend, frontend, and database - 9 development and CI scripts - Gitea Actions CI/CD workflows - Comprehensive documentation (8 files) - 45 template files for complete project structure - Automated verification script (all tests pass) - Based on coding-agent-rules standards
This commit is contained in:
22
templates/scripts/ci/backend-test.sh
Executable file
22
templates/scripts/ci/backend-test.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Backend CI test script
|
||||
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")/../../backend"
|
||||
|
||||
echo "Installing dependencies..."
|
||||
uv sync
|
||||
uv pip install --system -e ".[dev]"
|
||||
|
||||
echo "Running linter..."
|
||||
uv run ruff check app tests
|
||||
|
||||
echo "Running type checker..."
|
||||
uv run mypy app
|
||||
|
||||
echo "Running tests with coverage..."
|
||||
uv run pytest --cov=app --cov-report=term-missing --cov-report=xml --cov-fail-under=100
|
||||
|
||||
echo "Backend tests passed!"
|
||||
18
templates/scripts/ci/frontend-test.sh
Executable file
18
templates/scripts/ci/frontend-test.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Frontend CI test script
|
||||
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")/../../frontend"
|
||||
|
||||
echo "Installing dependencies..."
|
||||
npm ci
|
||||
|
||||
echo "Running linter..."
|
||||
npm run lint
|
||||
|
||||
echo "Running tests with coverage..."
|
||||
npm run test:coverage
|
||||
|
||||
echo "Frontend tests passed!"
|
||||
26
templates/scripts/dev/reset-database.sh
Executable file
26
templates/scripts/dev/reset-database.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Reset database (WARNING: This will delete all data)
|
||||
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")/../../deploy"
|
||||
|
||||
echo "WARNING: This will delete all database data!"
|
||||
read -p "Are you sure you want to continue? (yes/no): " confirm
|
||||
|
||||
if [ "$confirm" != "yes" ]; then
|
||||
echo "Aborted."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Stopping database container..."
|
||||
docker compose down database
|
||||
|
||||
echo "Removing database volume..."
|
||||
docker volume rm $(basename $(pwd))_postgres-data 2>/dev/null || true
|
||||
|
||||
echo "Starting fresh database..."
|
||||
docker compose up -d database
|
||||
|
||||
echo "Database reset complete"
|
||||
31
templates/scripts/dev/start-backend.sh
Executable file
31
templates/scripts/dev/start-backend.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Start backend development server
|
||||
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")/../../backend"
|
||||
|
||||
echo "Starting backend server..."
|
||||
|
||||
if [ ! -f ".env" ]; then
|
||||
echo "Creating .env from .env.example..."
|
||||
cp .env.example .env
|
||||
fi
|
||||
|
||||
# Check if uv is installed
|
||||
if ! command -v uv &> /dev/null; then
|
||||
echo "Error: uv is not installed. Please install it first."
|
||||
echo "Visit: https://github.com/astral-sh/uv"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Install dependencies if needed
|
||||
if [ ! -d ".venv" ]; then
|
||||
echo "Installing dependencies..."
|
||||
uv sync
|
||||
fi
|
||||
|
||||
# Start the server
|
||||
echo "Starting uvicorn..."
|
||||
uv run uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
|
||||
14
templates/scripts/dev/start-database.sh
Executable file
14
templates/scripts/dev/start-database.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Start database container
|
||||
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")/../../deploy"
|
||||
|
||||
echo "Starting database container..."
|
||||
|
||||
docker compose up -d database
|
||||
|
||||
echo "Database started successfully"
|
||||
echo "Connection string: postgresql://postgres:postgres@localhost:5432/appdb"
|
||||
24
templates/scripts/dev/start-frontend.sh
Executable file
24
templates/scripts/dev/start-frontend.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Start frontend development server
|
||||
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")/../../frontend"
|
||||
|
||||
echo "Starting frontend server..."
|
||||
|
||||
if [ ! -f ".env" ]; then
|
||||
echo "Creating .env from .env.example..."
|
||||
cp .env.example .env
|
||||
fi
|
||||
|
||||
# Install dependencies if needed
|
||||
if [ ! -d "node_modules" ]; then
|
||||
echo "Installing dependencies..."
|
||||
npm install
|
||||
fi
|
||||
|
||||
# Start the server
|
||||
echo "Starting React development server..."
|
||||
npm start
|
||||
17
templates/scripts/utils/format-all.sh
Executable file
17
templates/scripts/utils/format-all.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Format all code
|
||||
|
||||
set -e
|
||||
|
||||
PROJECT_ROOT="$(dirname "$0")/../.."
|
||||
|
||||
echo "Formatting backend code..."
|
||||
cd "$PROJECT_ROOT/backend"
|
||||
uv run ruff format app tests
|
||||
|
||||
echo "Formatting frontend code..."
|
||||
cd "$PROJECT_ROOT/frontend"
|
||||
npm run format
|
||||
|
||||
echo "All code formatted!"
|
||||
15
templates/scripts/utils/lint-backend.sh
Executable file
15
templates/scripts/utils/lint-backend.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Lint backend code
|
||||
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")/../../backend"
|
||||
|
||||
echo "Running ruff linter..."
|
||||
uv run ruff check app tests
|
||||
|
||||
echo "Running mypy type checker..."
|
||||
uv run mypy app
|
||||
|
||||
echo "Backend linting complete!"
|
||||
12
templates/scripts/utils/lint-frontend.sh
Executable file
12
templates/scripts/utils/lint-frontend.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Lint frontend code
|
||||
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")/../../frontend"
|
||||
|
||||
echo "Running ESLint..."
|
||||
npm run lint
|
||||
|
||||
echo "Frontend linting complete!"
|
||||
Reference in New Issue
Block a user