Skip to content

Define backend architecture and API folder structure for Next.js app router #104

@1nonlypiece

Description

@1nonlypiece

Description

Design and document the backend architecture for the app, including how API routes, service modules, and shared utilities are organized, to minimize merge conflicts and make contributions consistent.

Implementation Requirements

  • Create a src/app/api structure using the Next.js App Router (e.g. src/app/api/commitments/route.ts, etc.).
  • Create a src/lib/backend folder to hold:
    • src/lib/backend/config.ts for backend‑specific config helpers (reading env, network, contract addresses).
    • src/lib/backend/errors.ts for shared error types and helpers.
    • src/lib/backend/response.ts for standard JSON response helpers (success/error).
  • Document backend architecture in BACKEND_ISSUES.md or a short docs/backend-architecture.md:
    • Naming conventions for routes (/api/commitments, /api/attestations, /api/marketplace, /api/analytics, etc.).
    • Where services live (src/lib/backend/services/...).
    • Guidelines for new issues (one domain per service file, avoid editing shared files).

Acceptance Criteria

  • src/app/api folder exists with a clear subfolder structure (even if routes are placeholders).
  • src/lib/backend/config.ts, errors.ts, and response.ts exist with basic helpers and TODOs.
  • Backend architecture document created and linked from the repo README or this file.
  • Contribution guidelines for backend (what to touch / not touch) are written.

Technical Notes

  • Use Next.js App Router route.ts pattern for API endpoints.
  • Keep shared helpers minimal but stable to reduce future edits.

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions