A comprehensive knowledge base web application for Nigerian support and intervention programs. Built with Next.js and designed for easy deployment to Vercel.
- Public Interface: Browse and search support programs with advanced filtering
- Responsive Design: Works on desktop, tablet, and mobile devices
- Admin Panel: Secure interface for adding new programs
- No External Database: Uses file-based storage for simplicity
- Search & Filter: Find programs by name, type, operator, or target group
- Export Ready: Easy deployment to Vercel
- Node.js 18+ installed
- npm or yarn package manager
-
Clone or download the project files
-
Install dependencies:
npm install
-
Set up environment variables:
cp .env.example .env.local
-
Configure your admin credentials in
.env.local:# Generate a password hash node -e "console.log(require('bcryptjs').hashSync('your-secure-password', 12))" # Update .env.local with your values ADMIN_USERNAME=your-admin-username ADMIN_PASSWORD_HASH=generated-hash-from-above JWT_SECRET=your-very-secure-random-secret-key
-
Create the data directory and add your programs:
mkdir data
Copy your programs data to
data/programs.jsonusing the structure shown in the example file. -
Run the development server:
npm run dev
-
Open your browser to
http://localhost:3000
The application expects data in JSON format. Here's how to convert your Excel file:
Each program should have this structure:
{
"id": "unique-id",
"programme": "Program Name",
"type": "Program Type",
"operator": "Operating Organization",
"targetGroup": "Target Beneficiaries",
"benefit": "What the program offers",
"loanGrantSize": "Amount or size",
"statusWindow": "Current status or application window",
"whereToApply": "How to apply",
"source": "Official website URL",
"dateAdded": "2024-09-27T18:20:00.000Z",
"lastUpdated": "2024-09-27T18:20:00.000Z"
}- Export your Excel file to CSV
- Use any CSV to JSON converter online, or
- Use the admin panel to add programs one by one
- Or create a script to batch import (see
scripts/import.jsexample below)
-
Push your code to GitHub/GitLab
-
Connect to Vercel:
- Go to vercel.com
- Import your repository
- Configure environment variables in Vercel dashboard
-
Set Environment Variables in Vercel:
ADMIN_USERNAME=your-admin-username ADMIN_PASSWORD_HASH=your-generated-hash JWT_SECRET=your-secure-secret-key NODE_ENV=production -
Deploy: Vercel will automatically build and deploy your application.
- Navigate to
/adminon your deployed site - Login with your configured credentials
- Add new programs through the secure form interface
- Username:
admin - Password:
admin123
├── app/
│ ├── admin/
│ │ └── page.tsx # Admin panel
│ ├── api/
│ │ ├── auth/
│ │ │ ├── route.ts # Authentication endpoints
│ │ │ └── verify/
│ │ │ └── route.ts # Auth verification
│ │ └── programs/
│ │ └── route.ts # Programs API
│ ├── globals.css # Global styles
│ ├── layout.tsx # App layout
│ └── page.tsx # Home page
├── data/
│ └── programs.json # Programs database
├── lib/
│ └── auth.ts # Authentication utilities
├── .env.example # Environment variables template
├── next.config.js # Next.js configuration
├── package.json # Dependencies
├── tailwind.config.js # Tailwind CSS config
└── README.md # This file
- Password Hashing: Secure bcrypt password storage
- JWT Authentication: Secure token-based auth
- HTTP-Only Cookies: Prevents XSS attacks
- Input Validation: Server-side validation for all inputs
- CSRF Protection: Built-in Next.js CSRF protection
- Edit
app/globals.cssfor custom styles - Modify
tailwind.config.jsfor theme changes - Update colors in the Nigeria green theme
- Add new API routes in
app/api/ - Create new pages in
app/ - Extend the Program interface in TypeScript files
Your programs data is stored in data/programs.json. Regular backups are recommended:
# Download from Vercel (if using Vercel CLI)
vercel env pull .env.local
# Or manually copy the file from your repository- Use the admin panel for individual updates
- Edit
data/programs.jsondirectly for bulk updates - Deploy changes through your Git workflow
-
Admin login not working:
- Check environment variables are set correctly
- Verify password hash generation
- Check browser developer tools for error messages
-
Programs not loading:
- Ensure
data/programs.jsonexists and is valid JSON - Check file permissions
- Verify API routes are accessible
- Ensure
-
Deployment issues:
- Check Vercel build logs
- Verify all environment variables are set
- Ensure all dependencies are in package.json
- Check the browser console for JavaScript errors
- Review server logs in Vercel dashboard
- Ensure all environment variables are properly configured
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is designed for public benefit and information sharing about Nigerian support programs.
Built with ❤️ for the Nigerian community