A modern Next.js application for managing school-parent communication and engagement.
- Node.js 18+ and npm
- Backend API running (see backend repository)
- Clone the repository
- Install dependencies:
npm install- Configure environment variables:
Copy .env.example to .env.local and update the values:
cp .env.example .env.localEdit .env.local with your settings:
# Backend API - REQUIRED
NEXT_PUBLIC_API_BASE_URL=https://your-backend-url.com
NEXT_PUBLIC_API_TIMEOUT=30000
# Google Services (Optional)
NEXT_PUBLIC_GOOGLE_MAPS_PLATFORM_KEY=your_google_maps_key
# Feature Flags - Enable/disable API integrations
NEXT_PUBLIC_FF_REAL_AUTH=true
NEXT_PUBLIC_FF_REAL_SCHOOLS=true
NEXT_PUBLIC_FF_REAL_BRANCHES=false
NEXT_PUBLIC_FF_REAL_ANALYTICS=false
NEXT_PUBLIC_FF_REAL_BILLING=false
NEXT_PUBLIC_FF_REAL_SETTINGS=false
NEXT_PUBLIC_FF_REAL_ONBOARDING=trueImportant:
- Always use environment variables for configuration
- Never hardcode URLs or API keys in the source code
- The
NEXT_PUBLIC_prefix is required for client-side access - Restart the dev server after changing environment variables
npm run devOpen http://localhost:3000 in your browser.
npm run build
npm start├── app/ # Next.js app directory (routes)
├── src/
│ ├── components/ # Reusable React components
│ ├── config/ # Configuration files
│ ├── context/ # React context providers
│ ├── features/ # Feature-based modules
│ ├── lib/ # Utilities and API clients
│ │ ├── api/ # API client and configuration
│ │ ├── hooks/ # Custom React hooks
│ │ ├── services/ # API service layers
│ │ └── types/ # TypeScript type definitions
│ └── ...
├── components/ # shadcn/ui components
└── public/ # Static assets
This project uses shadcn/ui for UI components.
To add components:
npx shadcn@latest add buttonThis will place the UI components in the components/ui directory.
import { Button } from "@/components/ui/button";
export default function MyComponent() {
return <Button>Click me</Button>;
}The application uses feature flags to gradually enable backend integrations:
NEXT_PUBLIC_FF_REAL_AUTH- Use real authentication APINEXT_PUBLIC_FF_REAL_SCHOOLS- Use real schools APINEXT_PUBLIC_FF_REAL_BRANCHES- Use real branches APINEXT_PUBLIC_FF_REAL_ANALYTICS- Use real analytics APINEXT_PUBLIC_FF_REAL_BILLING- Use real billing APINEXT_PUBLIC_FF_REAL_SETTINGS- Use real settings APINEXT_PUBLIC_FF_REAL_ONBOARDING- Use real onboarding API
Set to true to enable, false to use mock data.
- Never hardcode URLs or secrets - Always use environment variables
- Use the config module - Import from
@/lib/api/configor@/config/featureFlags - Validate environment variables - The config module validates required variables
- Document new variables - Update
.env.examplewhen adding new variables
All API calls go through the centralized API client in src/lib/api/client.ts:
import { apiRequest } from '@/lib/api/client';
const response = await apiRequest({
method: 'GET',
path: '/api/schools/',
});The client automatically:
- Adds authentication headers
- Handles token refresh
- Provides error normalization
- Implements retry logic
- Manages request caching
- Ensure the variable name starts with
NEXT_PUBLIC_for client-side access - Restart the development server after changing
.env.local - Check the browser console for configuration logs (development mode only)
- Verify
NEXT_PUBLIC_API_BASE_URLis set correctly in.env.local - Check that the backend server is running
- Look for CORS issues in the browser console
- Verify authentication tokens are valid
MIT License