Paul R Kartchner 2d53b9e283
Some checks failed
CI Pipeline / Lint Code (push) Has been cancelled
CI Pipeline / Test API Package (push) Has been cancelled
CI Pipeline / Test Web Package (push) Has been cancelled
CI Pipeline / Test Shared Package (push) Has been cancelled
CI Pipeline / Build All Packages (push) Has been cancelled
CI Pipeline / Generate Coverage Report (push) Has been cancelled
Docker Build & Deploy / Build Docker Images (push) Has been cancelled
Docker Build & Deploy / Push Docker Images (push) Has been cancelled
Docker Build & Deploy / Deploy to Staging (push) Has been cancelled
Docker Build & Deploy / Deploy to Production (push) Has been cancelled
E2E Tests / End-to-End Tests (push) Has been cancelled
E2E Tests / E2E Tests (Mobile) (push) Has been cancelled
Security Scanning / NPM Audit (push) Has been cancelled
Security Scanning / Dependency License Check (push) Has been cancelled
Security Scanning / Code Quality Scan (push) Has been cancelled
Security Scanning / Docker Image Security (push) Has been cancelled
Security Scanning / Security Summary (push) Has been cancelled
feat: add comprehensive authentication system with JWT and OAuth
Implement a complete authentication system with local email/password
authentication, Google OAuth, JWT tokens, and role-based access control.

Backend Features:
- Database schema with User, RefreshToken, VerificationToken, RecipeShare models
- Role-based access control (USER, ADMIN)
- Recipe visibility controls (PRIVATE, SHARED, PUBLIC)
- Email verification for local accounts
- Password reset functionality
- JWT access tokens (15min) and refresh tokens (7 days)
- Passport.js strategies: Local, JWT, Google OAuth
- bcrypt password hashing with 12 salt rounds
- Password strength validation (min 8 chars, uppercase, lowercase, number)
- Rate limiting on auth endpoints (5 attempts/15min)
- Email service with styled HTML templates for verification and password reset

API Endpoints:
- POST /api/auth/register - Register with email/password
- POST /api/auth/login - Login and get tokens
- POST /api/auth/logout - Invalidate refresh token
- POST /api/auth/refresh - Get new access token
- GET /api/auth/verify-email/:token - Verify email address
- POST /api/auth/resend-verification - Resend verification email
- POST /api/auth/forgot-password - Request password reset
- POST /api/auth/reset-password - Reset password with token
- GET /api/auth/google - Initiate Google OAuth
- GET /api/auth/google/callback - Google OAuth callback
- GET /api/auth/me - Get current user info

Security Middleware:
- requireAuth - Protect routes requiring authentication
- requireAdmin - Admin-only route protection
- optionalAuth - Routes that work with or without auth
- requireOwnership - Check resource ownership

Admin Tools:
- npm run create-admin - Interactive script to create admin users
- verify-user-manual.ts - Helper script for testing

Test Coverage:
- 49 unit and integration tests (all passing)
- Password utility tests (12 tests)
- JWT utility tests (17 tests)
- Auth middleware tests (12 tests)
- Auth routes integration tests (8 tests)

Dependencies Added:
- passport, passport-local, passport-jwt, passport-google-oauth20
- bcrypt, jsonwebtoken
- nodemailer
- express-rate-limit, express-validator, cookie-parser

Environment Variables Required:
- JWT_SECRET, JWT_REFRESH_SECRET
- JWT_EXPIRES_IN, JWT_REFRESH_EXPIRES_IN
- GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET (optional)
- SMTP configuration for email
- APP_URL, API_URL

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 04:37:05 +00:00
2025-10-21 22:04:03 -06:00
2025-10-21 22:04:03 -06:00

Basil 🌿

A modern, full-stack recipe manager with web and mobile support. Import recipes from any URL, manage your recipe collection, and access them from anywhere.

Features

  • Recipe Import: Automatically import recipes from URLs using schema.org markup
  • Full Recipe Management: Create, read, update, and delete recipes
  • Rich Recipe Data: Store ingredients, instructions, prep/cook times, servings, images, and more
  • Search & Filter: Find recipes by title, cuisine, category, or tags
  • Multiple Images: Add multiple images to each recipe
  • Flexible Storage: Local filesystem storage by default, optional S3 support
  • Docker Support: Easy deployment with Docker Compose
  • API-First Design: RESTful API for web and future mobile apps

Tech Stack

  • Backend: Node.js, TypeScript, Express, Prisma ORM, PostgreSQL
  • Frontend: React, TypeScript, Vite, React Router
  • Infrastructure: Docker, Docker Compose, nginx
  • Monorepo: npm workspaces with shared types

Quick Start

Prerequisites

  • Node.js 20+
  • PostgreSQL 16+ (or use Docker)
  • Docker (optional, for containerized deployment)

Development Setup

  1. Clone the repository

    git clone <repository-url>
    cd basil
    
  2. Install dependencies

    npm install
    
  3. Set up environment variables

    cp packages/api/.env.example packages/api/.env
    # Edit packages/api/.env with your database credentials
    
  4. Start PostgreSQL (if not using Docker)

    # Create a database named 'basil'
    createdb basil
    
  5. Run database migrations

    cd packages/api
    npm run prisma:migrate
    npm run prisma:generate
    cd ../..
    
  6. Start development servers

    npm run dev
    

    This starts:

Docker Deployment

For production or easy local setup:

# Start all services
docker-compose up -d

# View logs
docker-compose logs -f

# Stop services
docker-compose down

Services will be available at:

Project Structure

basil/
├── packages/
│   ├── api/          # Backend API server
│   │   ├── prisma/   # Database schema and migrations
│   │   └── src/      # Express routes, services, config
│   ├── web/          # React web application
│   │   └── src/      # Components, pages, services
│   └── shared/       # Shared TypeScript types
├── docker-compose.yml
└── package.json      # Workspace root

Usage

Importing a Recipe

  1. Navigate to "Import Recipe" in the web app
  2. Paste a recipe URL (from sites like AllRecipes, Food Network, etc.)
  3. Preview the imported recipe
  4. Save to your collection

API Examples

Import recipe from URL:

curl -X POST http://localhost:3001/api/recipes/import \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/recipe"}'

Get all recipes:

curl http://localhost:3001/api/recipes

Create a recipe:

curl -X POST http://localhost:3001/api/recipes \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Chocolate Chip Cookies",
    "ingredients": [
      {"name": "flour", "amount": "2", "unit": "cups", "order": 0}
    ],
    "instructions": [
      {"step": 1, "text": "Preheat oven to 350°F"}
    ]
  }'

Configuration

Storage Options

Local Storage (Default):

STORAGE_TYPE=local
LOCAL_STORAGE_PATH=./uploads

S3 Storage:

STORAGE_TYPE=s3
S3_BUCKET=your-bucket-name
S3_REGION=us-east-1
S3_ACCESS_KEY_ID=your-access-key
S3_SECRET_ACCESS_KEY=your-secret-key

Database

Default PostgreSQL connection:

DATABASE_URL=postgresql://basil:basil@localhost:5432/basil?schema=public

For external database services (AWS RDS, DigitalOcean, etc.), update the connection string.

Development

Commands

# Install dependencies
npm install

# Start all services in development mode
npm run dev

# Build all packages
npm run build

# Lint all packages
npm run lint

# Docker commands
npm run docker:up
npm run docker:down
npm run docker:build

Database Migrations

cd packages/api

# Create a new migration
npm run prisma:migrate

# Generate Prisma client
npm run prisma:generate

# Open Prisma Studio (GUI for database)
npm run prisma:studio

Future Enhancements

  • Mobile apps (React Native for iOS and Android)
  • User authentication and multi-user support
  • Recipe sharing and social features
  • Meal planning and grocery lists
  • Nutritional information calculation
  • Recipe scaling (adjust servings)
  • Print-friendly recipe view
  • Recipe collections and cookbooks

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Description
Basil is my recipe tracker
Readme 1.5 MiB
2026-01-20 04:38:55 +00:00
Languages
TypeScript 82.6%
CSS 11.8%
Shell 4.1%
JavaScript 0.9%
Python 0.4%
Other 0.2%