placebo.mk/SETUP_COMPLETE.md
2026-01-10 19:41:04 +01:00

3.7 KiB

Placebo.mk - Basic Structure Complete

What's Been Built

Backend (NestJS)

  • NestJS project initialized with TypeScript
  • TypeORM configured with SQLite database
  • Entities created: Article, Author, Category
  • Articles module with full CRUD operations
  • DTOs with validation (CreateArticleDto, UpdateArticleDto, FindArticlesDto)
  • Service layer with business logic
  • REST API endpoints
  • CORS configured for frontend and Strapi
  • Strapi integration service with webhook support
  • HTTP client for fetching Strapi content
  • Content sync from Strapi to local database
  • Environment variables setup
  • Type checking configured
  • Linting configured

Frontend (TanStack)

  • Vite + React + TypeScript project initialized
  • TanStack Router configured
  • TanStack Query configured
  • Basic routes created: home, articles list, article detail
  • API client with TypeScript interfaces
  • Custom hooks for data fetching
  • Environment variables setup
  • Type checking configured
  • Linting configured

CMS (Strapi)

  • Strapi installed in cms/cms/ directory
  • Project initialized with TypeScript

Project Structure

  • Monorepo structure with backend, frontend, cms directories
  • .gitignore for all projects
  • AGENTS.md with comprehensive guidelines
  • STRUCTURE.md with project overview
  • STRAPI_INTEGRATION.md with setup instructions
  • Environment variable templates (.env.example)

🚀 Ready to Use

Backend

cd backend
npm install
cp .env.example .env
# Edit .env to add STRAPI_API_TOKEN
npm run start:dev
# API available at http://localhost:3000/api/v1

Frontend

cd frontend
npm install
cp .env.example .env
npm run dev
# App available at http://localhost:5173

Strapi CMS

cd cms/cms
npm run develop
# Admin panel available at http://localhost:1337/admin

📦 Strapi Integration

The backend now includes:

  • StrapiService: Fetches and syncs content from Strapi
  • StrapiController: Handles webhooks from Strapi
  • Manual sync endpoint: POST /api/v1/webhooks/strapi/sync/all
  • Webhook endpoint: POST /api/v1/webhooks/strapi/article

Setup Steps:

  1. Create content types in Strapi: Article, Author, Category, Tag (see STRAPI_INTEGRATION.md)
  2. Create API token in Strapi admin panel
  3. Add token to backend .env as STRAPI_API_TOKEN
  4. Configure webhook in Strapi to point to backend
  5. Start all three services

🔜 Next Steps

  1. Configure Strapi content types following STRAPI_INTEGRATION.md
  2. Create webhook in Strapi for automatic sync
  3. Implement frontend UI components for displaying articles
  4. Add authentication for the CMS
  5. Set up image handling with Strapi media library
  6. Implement search and filtering in the frontend
  7. Add analytics for article views
  8. Set up deployment for all three services

📝 API Endpoints Available

Articles

  • GET /api/v1/articles - List articles with pagination and filters
  • GET /api/v1/articles/:id - Get article by ID
  • GET /api/v1/articles/slug/:slug - Get article by slug
  • POST /api/v1/articles - Create article (for Strapi sync)
  • PUT /api/v1/articles/:id - Update article
  • DELETE /api/v1/articles/:id - Delete article

Webhooks & Sync

  • POST /api/v1/webhooks/strapi/article - Handle Strapi webhooks
  • POST /api/v1/webhooks/strapi/sync/all - Trigger full sync

All article endpoints support query parameters:

  • category - Filter by category slug
  • author - Filter by author slug
  • tag - Filter by tag
  • status - Filter by status (draft/published/archived)
  • search - Full-text search in title and content
  • page - Page number (default: 1)
  • limit - Items per page (default: 10)