How shine0078/cars-portfolio works
What this project is (type + purpose)
This repo is a headless-CMS + frontend system:
• Frontend: a Next.js (Pages Router) web app at the repo root (next.config.mjs, src/pages/*, src/components/*).
• Backend/CMS: a Strapi project under my-project/ (Strapi-style config/*, src/api/*, database/migrations/*, public/uploads/*, src/admin/*).
• The intended architecture is: Next.js renders UI and reads content/data from Strapi (and potentially uses Next.js API routes for small server-side utilities).
Next.js app (repo root)
Key directories/files to model:
• src/pages/*
• index.js, projects/index.js, experience/index.js → primary routes/pages.
• src/pages/api/hello.js → Next.js API route (serverless/function or Node handler depending on deployment).
• _app.js, _document.js → app shell / document customization.
• src/components/header/*, src/components/footer/* → shared UI components.
• “Pages (Routes)”
• “UI Components”
• “Strapi Client / Data Access Layer”
• “Next API routes” (if used beyond the template)
Strapi backend (my-project/)
Key directories/files to model:
• my-project/config/*
• server.ts, database.ts, middlewares.ts, plugins.ts, api.ts, admin.ts → Strapi runtime configuration.
• my-project/src/index.ts → Strapi bootstrap/entry customization point.
• my-project/src/api/email/*
• content-types/email/schema.json → a Strapi content type (Email).
• controllers/email.ts, routes/email.ts, services/email.ts → classic Strapi layering (route → controller → service).
• my-project/database/migrations/* → DB schema migrations (indicates a real DB is used; exact engine depends on config/database.ts).
• my-project/public/uploads/* → Strapi local media storage (or placeholder for a provider; the folder indicates at least local dev storage).
• my-project/src/admin/* (app.example.tsx, vite.config.example.ts) → Strapi Admin UI customization/build configuration.
• “REST/Content API”
• “Email API (route/controller/service)”
• “Database access layer / ORM (Strapi’s internal)”
• “Admin UI”
• “Uploads/Media storage”
Shared / environment / deployment
• There are two package.json files (root and my-project/package.json) → two separately built/deployed apps.
• Likely runtime:
• Next.js: Vercel or Node server
• Strapi: Node server (container/VM/PaaS) + database
Browser → Next.js
• Users request pages: GET /, /projects, /experience.
Next.js → Strapi Content API
• Next pages call src/lib/strapi.js to fetch content from Strapi endpoints.
• “HTTPS (REST) /api/*”
• “Fetch content + media URLs”
Strapi → Database
• Strapi persists content types (including email) into the DB defined in my-project/config/database.ts.
Strapi → Uploads/Media storage
• For media/content assets: local public/uploads or external provider (if configured).
Admin user (content editor) → Strapi Admin UI
• Admin accesses Strapi admin panel to manage content.
(Optional) Browser/Next.js → Next.js API routes
• If used, show: Browser → Next API route → (maybe Strapi/other services).
Architectural patterns to highlight (from structure)
• Headless CMS pattern: Strapi is the system of record; Next.js is presentation.
• Layered backend design in Strapi: routes → controllers → services → persistence.
• Separation of deployables: two independent Node applications with separate dependency graphs and release lifecycles.
• Content-type driven domain: schema.json defines the “Email” model; code is organized per-content-type.
“Don’t overthink it”: split into as many components as possible (specific to this repo)
To be maximally detailed (and still accurate), break it down like this:
Next.js breakdown
• Router/Pages:
• / (src/pages/index.js)
• /projects (src/pages/projects/index.js)
• /experience (src/pages/experience/index.js)
• UI:
• Header (src/components/header/header.js)
• Footer (src/components/footer/footer.js)
• Data access:
• Strapi client wrapper (src/lib/strapi.js, src/lib/dist/strapi.dev.js)
• API:
• Next API routes (src/pages/api/*) — currently hello.js
Strapi breakdown
• Admin UI customization:
• API Modules:
• Email module: schema + routes + controller + service
• Core runtime config:
• my-project/config/server.ts (server settings)
• my-project/config/database.ts (DB connection)
• my-project/config/middlewares.ts
• my-project/config/plugins.ts
• Persistence:
• DB + migrations
• Assets:
• uploads folder