Files
Sankofa/docs/guides/DEVELOPMENT.md
defiQUG fe0365757a Update documentation structure and enhance .gitignore
- Added generated index files and report directories to .gitignore to prevent unnecessary tracking of transient files.
- Updated README links to reflect new documentation paths for better navigation.
- Improved documentation organization by ensuring all links point to the correct locations, enhancing user experience and accessibility.
2025-12-12 21:18:55 -08:00

2.7 KiB

Development Guide

Last Updated: 2025-01-09

This guide will help you set up your development environment for Sankofa Phoenix.

Prerequisites

  • Node.js 18+ and pnpm (or npm/yarn)
  • PostgreSQL 14+ (for API)
  • Go 1.21+ (for Crossplane provider)
  • Docker (optional, for local services)

Initial Setup

1. Clone the Repository

git clone https://github.com/sankofa/Sankofa.git
cd Sankofa

2. Install Dependencies

# Main application
pnpm install

# Portal
cd portal
npm install
cd ..

# API
cd api
npm install
cd ..

# Crossplane Provider
cd crossplane-provider-proxmox
go mod download
cd ..

3. Set Up Environment Variables

Create .env.local files:

# Root .env.local
cp .env.example .env.local

# Portal .env.local
cd portal
cp .env.example .env.local
cd ..

# API .env.local
cd api
cp .env.example .env.local
cd ..

4. Set Up Database

# Create database
createdb sankofa

# Run migrations
cd api
npm run db:migrate

Running the Application

Development Mode

# Main app (port 3000)
pnpm dev

# Portal (port 3001)
cd portal
npm run dev

# API (port 4000)
cd api
npm run dev

Running Tests

# Main app tests
pnpm test

# Portal tests
cd portal
npm test

# Crossplane provider tests
cd crossplane-provider-proxmox
go test ./...

Project Structure

Sankofa/
├── src/              # Main Next.js app
├── portal/           # Portal application
├── api/              # GraphQL API server
├── crossplane-provider-proxmox/  # Crossplane provider
├── gitops/           # GitOps configurations
├── cloudflare/       # Cloudflare configs
└── docs/             # Documentation

Common Tasks

Adding a New Component

  1. Create component in src/components/
  2. Add tests in src/components/**/*.test.tsx
  3. Export from appropriate index file
  4. Update Storybook (if applicable)

Adding a New API Endpoint

  1. Add GraphQL type definition in api/src/schema/typeDefs.ts
  2. Add resolver in api/src/schema/resolvers.ts
  3. Add service logic in api/src/services/
  4. Add tests

Database Migrations

cd api
# Create migration
npm run db:migrate:create migration-name

# Run migrations
npm run db:migrate

Debugging

Frontend

  • Use React DevTools
  • Check browser console
  • Use Next.js debug mode: NODE_OPTIONS='--inspect' pnpm dev

Backend

  • Use VS Code debugger
  • Check API logs
  • Use GraphQL Playground at http://localhost:4000/graphql

Code Quality

Linting

pnpm lint

Type Checking

pnpm type-check

Formatting

pnpm format

Troubleshooting

See TROUBLESHOOTING.md for common issues and solutions.