3.7 KiB
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:
- Create content types in Strapi: Article, Author, Category, Tag (see STRAPI_INTEGRATION.md)
- Create API token in Strapi admin panel
- Add token to backend
.envasSTRAPI_API_TOKEN - Configure webhook in Strapi to point to backend
- Start all three services
🔜 Next Steps
- Configure Strapi content types following STRAPI_INTEGRATION.md
- Create webhook in Strapi for automatic sync
- Implement frontend UI components for displaying articles
- Add authentication for the CMS
- Set up image handling with Strapi media library
- Implement search and filtering in the frontend
- Add analytics for article views
- Set up deployment for all three services
📝 API Endpoints Available
Articles
GET /api/v1/articles- List articles with pagination and filtersGET /api/v1/articles/:id- Get article by IDGET /api/v1/articles/slug/:slug- Get article by slugPOST /api/v1/articles- Create article (for Strapi sync)PUT /api/v1/articles/:id- Update articleDELETE /api/v1/articles/:id- Delete article
Webhooks & Sync
POST /api/v1/webhooks/strapi/article- Handle Strapi webhooksPOST /api/v1/webhooks/strapi/sync/all- Trigger full sync
All article endpoints support query parameters:
category- Filter by category slugauthor- Filter by author slugtag- Filter by tagstatus- Filter by status (draft/published/archived)search- Full-text search in title and contentpage- Page number (default: 1)limit- Items per page (default: 10)