Skip to content

abushaidislam/codex-Blog

Repository files navigation

readoft.blog

Modern blog platform built with TypeScript, Next.js, GraphQL Yoga, Prisma, and PostgreSQL.

πŸš€ Quick Start

Prerequisites

  • Node.js β‰₯ 20.0.0
  • pnpm β‰₯ 9.0.0
  • Docker & Docker Compose

Installation

# Install dependencies
pnpm install -w

# Start local services (PostgreSQL, Memcached, MinIO, MailHog)
docker compose up -d

# Set up environment variables
cp apps/api/.env.example apps/api/.env

# Run database migrations
pnpm prisma:generate
pnpm prisma:migrate

# Seed the database with test data
pnpm db:seed

# Start development servers
pnpm dev

The web app will be available at http://localhost:3000 and the GraphQL API at http://localhost:4000/graphql.

πŸ“ Project Structure

readoft-blog/
β”œβ”€β”€ apps/
β”‚   β”œβ”€β”€ web/              # Next.js frontend
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ app/      # Next.js App Router
β”‚   β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   └── lib/
β”‚   β”‚   └── package.json
β”‚   └── api/              # GraphQL Yoga backend
β”‚       β”œβ”€β”€ src/
β”‚       β”‚   β”œβ”€β”€ core/     # Schema, context, resolvers
β”‚       β”‚   └── adapters/ # External services
β”‚       β”œβ”€β”€ prisma/
β”‚       β”‚   β”œβ”€β”€ schema.prisma
β”‚       β”‚   └── seed.ts
β”‚       └── package.json
β”œβ”€β”€ packages/
β”‚   β”œβ”€β”€ ui/               # Shared UI components
β”‚   └── config/           # Shared configs
β”œβ”€β”€ docs/                 # Documentation
β”œβ”€β”€ scripts/              # Automation scripts
└── compose.yaml          # Docker services

πŸ› οΈ Development

Available Commands

# Development
pnpm dev:web              # Start Next.js dev server
pnpm dev:api              # Start GraphQL API dev server
pnpm dev                  # Start both concurrently

# Build
pnpm build                # Build all packages

# Code Quality
pnpm lint                 # Run ESLint
pnpm format               # Check Prettier formatting
pnpm format:fix           # Fix Prettier formatting
pnpm typecheck            # Run TypeScript type checking

# Testing
pnpm test                 # Run all tests
pnpm test:watch           # Run tests in watch mode
pnpm test:coverage        # Run tests with coverage (β‰₯85% required)

# Database
pnpm prisma:generate      # Generate Prisma Client
pnpm prisma:migrate       # Run migrations
pnpm prisma:studio        # Open Prisma Studio
pnpm db:seed              # Seed database with test data

# Docker
pnpm docker:up            # Start all services
pnpm docker:down          # Stop all services

πŸ—οΈ Tech Stack

Frontend

  • Next.js 14 - React framework with App Router
  • TailwindCSS - Utility-first CSS
  • Radix UI - Accessible component primitives
  • Lucide React - Icon library
  • GraphQL - API client (Relay planned)

Backend

  • GraphQL Yoga - GraphQL server
  • Prisma - Type-safe ORM
  • PostgreSQL - Primary database
  • Memcached - Caching layer
  • MinIO - S3-compatible object storage
  • MailHog - Email testing (dev)

DevOps

  • Docker Compose - Local development services
  • pnpm Workspaces - Monorepo management
  • ESLint - Linting
  • Prettier - Code formatting
  • Vitest - Testing framework
  • Husky - Git hooks

πŸ“š Documentation

πŸ” Environment Variables

API (.env)

DATABASE_URL=postgresql://readoft:readoft_dev@localhost:5432/readoft_blog
PORT=4000
JWT_SECRET=your-secret-key
MEMCACHED_SERVERS=localhost:11211
S3_ENDPOINT=http://localhost:9000
SMTP_HOST=localhost
SMTP_PORT=1025

πŸ§ͺ Testing

All tests must pass with β‰₯85% branch coverage before merging.

# Run all tests
pnpm test

# Run tests with coverage
pnpm test:coverage

# Run specific test file
pnpm test -w -k user-service

🎨 Design System

  • Typography: Inter (UI), Source Serif Pro (content)
  • Colors: CSS variables for light/dark themes
  • Spacing: 4pt scale (4, 8, 12, 16...)
  • Border Radius: 1rem default
  • Mobile-first: Responsive breakpoints (sm: 640, md: 768, lg: 1024, xl: 1280)

πŸ“ Commit Convention

We follow Conventional Commits:

feat(web): add post editor
fix(api): resolve authentication bug
chore(config): update eslint rules
docs: update README

🚒 Deployment

Prerequisites

  • Node.js 20+ runtime
  • PostgreSQL 16+
  • S3-compatible storage
  • SMTP server

Build

pnpm build

Production Environment

Set production environment variables and run:

pnpm --filter @app/web start
pnpm --filter @app/api start

πŸ“„ License

MIT License - see LICENSE file for details.

🀝 Contributing

See CONTRIBUTING.md for contribution guidelines.

πŸ’¬ Support


Built with ❀️ by the readoft.blog team

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published