Skip to content

firstlovecenter/flcseek

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

240 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

FLCSeek - Church New Convert Tracking System

A comprehensive, performance-optimized church management system for tracking new convert spiritual growth, milestone progression, and attendance across monthly groups.

🌟 What is FLCSeek?

FLCSeek is a Progressive Web App (PWA) designed to help churches systematically track and nurture new converts through their spiritual journey. It provides role-based dashboards, real-time progress monitoring, bulk registration tools, and analytics to ensure no new believer falls through the cracks.

Key Features

βœ… Month-Based Organization - Organize new converts by registration month (January - December)
βœ… 18 Milestone Progression - Track spiritual growth through 18 customizable milestones
βœ… Attendance Tracking - Monitor church attendance with 26-week goal
βœ… Role-Based Access Control - Super Admin, Lead Pastor, Admin (Month Leader), and Sheep Seeker roles
βœ… Bulk Registration - Register multiple converts via Excel import
βœ… Real-Time Analytics - Department performance dashboards with visual progress indicators
βœ… Performance Optimized - Sub-second page loads with advanced database indexing
βœ… Theme Support - Light and dark mode with WCAG AA color contrast compliance

πŸš€ Quick Start (5 Minutes Setup)

Prerequisites

  • Node.js 18+ and npm installed
  • A Neon Database account (free tier available)

1. Clone and Install

git clone https://github.com/firstlovecenter/flcseek.git
cd flcseek
npm install

2. Set Up Database

  1. Create a free Neon database account at neon.tech
  2. Create a new project (choose your preferred region)
  3. Copy your connection string (looks like postgresql://user:pass@host/database)

3. Configure Environment Variables

Create a .env.local file in the root directory:

# Database Connection (REQUIRED)
NEON_DATABASE_URL=postgresql://username:password@host.neon.tech/database?sslmode=require

# Authentication Secret (REQUIRED - Change this to a random string!)
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production-min-32-chars

πŸ” Security Note: Generate a strong JWT_SECRET using:

node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"

4. Initialize Database Schema

Run the initial migration to create all tables, indexes, and seed data:

npm run db:setup

This will create:

  • 6 database tables (users, groups, milestones, new_converts, progress_records, attendance_records)
  • 15+ performance indexes for optimized queries
  • Default superadmin account (username: superadmin, password: admin123)
  • 18 spiritual growth milestones
  • 12 month groups for 2025

5. Start the Application

npm run dev

Visit http://localhost:3000 and log in with:

  • Username: superadmin
  • Password: admin123
  • Role: Super Administrator (full system access)

⚠️ IMPORTANT: Change the superadmin password immediately after first login!


πŸ“± Features Overview

For Super Admins

  • Full System Access - Manage all months, users, and converts
  • User Management - Create admin and sheep seeker accounts
  • Milestone Customization - Define and edit spiritual growth stages
  • Analytics Dashboard - View system-wide statistics and trends
  • Bulk Operations - Export data, bulk delete records
  • Database Management - Run migrations, view table statistics

For Lead Pastors

  • Multi-Month View - Track progress across all monthly groups
  • Comparative Analytics - See which months are performing well
  • Leadership Oversight - Monitor sheep seeker effectiveness
  • Progress Reports - Generate month-by-month progress reports

For Admins (Month Admins)

  • Month Management - Oversee a specific monthly group
  • Convert Registration - Register new converts (bulk or individual)
  • Progress Tracking - View milestone completion for all group members
  • Attendance Management - Mark attendance for group members

For Sheep Seekers (Month Leaders)

  • Assigned Converts - Manage specific converts in your month
  • Milestone Updates - Mark milestones as completed
  • Attendance Recording - Track church attendance
  • Individual Progress - View detailed convert profiles
  • Quick Actions - Fast navigation to common tasks

πŸ› οΈ Tech Stack

Technology Purpose
Next.js 13 React framework with App Router and Server Components
TypeScript Type-safe development
Ant Design Professional UI component library
Tailwind CSS Utility-first CSS framework
Neon Database Serverless PostgreSQL with auto-scaling
JWT + bcrypt Secure authentication and password hashing
next-pwa Progressive Web App capabilities

πŸ“Š Database Schema

Core Tables

  1. users - User accounts with role-based access
  2. groups - Month-based groups (e.g., "January 2025")
  3. milestones - Spiritual growth stages (18 default stages)
  4. new_converts - Registered new converts with contact info
  5. progress_records - Milestone completion tracking
  6. attendance_records - Church attendance records

Performance Optimizations

  • 15+ strategic indexes on frequently queried columns
  • Optimized JOIN queries eliminate N+1 problems
  • Single-query data fetching with JSON aggregation
  • Partial indexes for conditional filtering

πŸ—‚οΈ Project Structure

flcseek/
β”œβ”€β”€ app/                          # Next.js 13 App Router
β”‚   β”œβ”€β”€ api/                      # API Routes
β”‚   β”‚   β”œβ”€β”€ auth/                 # Authentication endpoints
β”‚   β”‚   β”œβ”€β”€ people/               # Convert management APIs
β”‚   β”‚   β”‚   β”œβ”€β”€ with-progress/    # Optimized endpoint (eliminates N+1)
β”‚   β”‚   β”‚   β”œβ”€β”€ with-stats/       # Aggregated stats endpoint
β”‚   β”‚   β”‚   └── bulk/             # Bulk registration
β”‚   β”‚   β”œβ”€β”€ milestones/           # Milestone CRUD
β”‚   β”‚   β”œβ”€β”€ groups/               # Group management
β”‚   β”‚   β”œβ”€β”€ attendance/           # Attendance tracking
β”‚   β”‚   β”œβ”€β”€ progress/             # Progress updates
β”‚   β”‚   └── superadmin/           # Admin-only endpoints
β”‚   β”œβ”€β”€ sheep-seeker/             # Sheep Seeker dashboard
β”‚   β”‚   β”œβ”€β”€ page.tsx              # Main milestone board
β”‚   β”‚   β”œβ”€β”€ progress/             # Progress view
β”‚   β”‚   β”œβ”€β”€ attendance/           # Attendance tracking
β”‚   β”‚   └── people/               # Convert registration
β”‚   β”œβ”€β”€ leader/                   # Admin (Month Leader) dashboard
β”‚   β”œβ”€β”€ leadpastor/               # Lead Pastor dashboard
β”‚   β”‚   └── [month]/              # Month-specific views
β”‚   β”œβ”€β”€ superadmin/               # Super Admin dashboard
β”‚   β”‚   β”œβ”€β”€ users/                # User management
β”‚   β”‚   β”œβ”€β”€ groups/               # Group management
β”‚   β”‚   β”œβ”€β”€ milestones/           # Milestone configuration
β”‚   β”‚   β”œβ”€β”€ converts/             # All converts view
β”‚   β”‚   β”œβ”€β”€ analytics/            # System analytics
β”‚   β”‚   └── database/             # Database management
β”‚   β”œβ”€β”€ person/[id]/              # Individual convert profile
β”‚   β”œβ”€β”€ layout.tsx                # Root layout with theme provider
β”‚   └── globals.css               # Global styles with theme variables
β”œβ”€β”€ components/                   # Reusable React components
β”‚   β”œβ”€β”€ ui/                       # shadcn/ui components
β”‚   β”œβ”€β”€ Navigation.tsx            # Role-based navigation
β”‚   β”œβ”€β”€ TopNav.tsx                # Top navigation bar
β”‚   └── PullToRefresh.tsx         # Mobile pull-to-refresh
β”œβ”€β”€ contexts/
β”‚   └── AuthContext.tsx           # Authentication context
β”œβ”€β”€ lib/                          # Utility functions
β”‚   β”œβ”€β”€ auth.ts                   # JWT token management & bcrypt
β”‚   β”œβ”€β”€ neon.ts                   # Database connection & query helper
β”‚   β”œβ”€β”€ constants.ts              # App-wide constants
β”‚   └── utils.ts                  # Helper functions
β”œβ”€β”€ db/
β”‚   └── migrations/               # Database migrations
β”‚       β”œβ”€β”€ 000_initial_setup.sql # Complete schema setup (NEW!)
β”‚       β”œβ”€β”€ 013_add_performance_indexes.sql
β”‚       └── 013_remove_full_name_column.sql
β”œβ”€β”€ public/                       # Static assets
β”‚   β”œβ”€β”€ manifest.json             # PWA manifest
β”‚   β”œβ”€β”€ sw.js                     # Service worker (auto-generated)
β”‚   └── icons/                    # PWA icons
β”œβ”€β”€ .env.local                    # Environment variables (create this)
β”œβ”€β”€ next.config.js                # Next.js configuration
β”œβ”€β”€ tailwind.config.ts            # Tailwind CSS configuration
└── package.json                  # Dependencies & scripts

πŸ” User Roles & Permissions

Role Hierarchy

Super Admin (Full Access)
    ↓
Lead Pastor (All Months Read)
    ↓
Admin (Single Month Edit Access)
    ↓
Leader (Single Month View Access)

Permission Matrix

Feature Super Admin Lead Pastor Admin Leader
View All Months βœ… βœ… ❌ ❌
Manage Assigned Month βœ… ❌ βœ… βœ…
Register New Converts βœ… ❌ βœ… ❌
Mark Milestones βœ… ❌ βœ… ❌
Track Attendance βœ… βœ… βœ… βœ…
Create Users βœ… ❌ ❌ ❌
Edit Milestones βœ… ❌ ❌ ❌
View Analytics βœ… βœ… ❌ ❌
Database Management βœ… ❌ ❌ ❌
Bulk Delete βœ… ❌ ❌ ❌

🚒 Deployment

Netlify (Recommended)

  1. Connect Repository

    # Push your code to GitHub
    git remote add origin https://github.com/yourusername/flcseek.git
    git push -u origin main
  2. Configure Netlify

    • Go to netlify.com and click "New site from Git"
    • Select your repository
    • Build settings:
      • Build command: npm run build
      • Publish directory: .next
  3. Set Environment Variables In Netlify Dashboard β†’ Site settings β†’ Environment variables:

    NEON_DATABASE_URL=your_production_database_url
    JWT_SECRET=your_production_jwt_secret
    
  4. Deploy

    • Click "Deploy site"
    • Your app will be live at https://your-site-name.netlify.app

Vercel (Alternative)

npm install -g vercel
vercel --prod

Set environment variables in Vercel Dashboard or via CLI:

vercel env add NEON_DATABASE_URL production
vercel env add JWT_SECRET production

πŸ”§ Common Tasks

Change Admin Password

  1. Log in as admin
  2. Navigate to Super Admin β†’ Users
  3. Click on admin user β†’ Edit β†’ Change Password

Create New User Accounts

  1. Super Admin β†’ Users β†’ Create User
  2. Fill in username, role, and assign to group (for admins/leaders)
  3. Provide credentials to new user

Customize Milestones

  1. Super Admin β†’ Milestones
  2. Edit existing milestones or add new ones
  3. Stage numbers must be unique (1-99)

Bulk Register Converts

  1. Download Excel template from Sheep Seeker β†’ Bulk Register
  2. Fill in convert information (Name, Phone, DOB, Gender, Location)
  3. Upload Excel file
  4. Review and confirm registration

Create New Year Groups

  1. Super Admin β†’ Groups β†’ Create Group
  2. Create 12 groups for new year (e.g., "January 2026")
  3. Assign leaders to each month

Run Additional Migrations

  1. Super Admin β†’ Database Management
  2. View available migrations
  3. Click "Run Migration" on pending migrations

Export Data

  1. Super Admin β†’ Converts
  2. Use filters (month, progress status, etc.)
  3. Click "Export to Excel"

πŸ“ˆ Performance Metrics

FLCSeek has been heavily optimized for performance:

Metric Before After Improvement
Milestone Board Load (100 people) 12s <1s 92% faster
API Requests per Page 101 1 99% reduction
Bulk Registration (50 people) 8s <1s 87% faster
Database Queries (progress fetch) 202+ 1 99.5% reduction

Key Optimizations Applied

βœ… Eliminated N+1 query problem with JOIN aggregation
βœ… Strategic database indexes on all foreign keys
βœ… HTTP caching with stale-while-revalidate
βœ… Bulk INSERT operations instead of loops
βœ… Server-side data aggregation
βœ… Single-query data fetching with JSON_AGG

See PERFORMANCE_OPTIMIZATIONS.md for technical details.


πŸ› Troubleshooting

Database Connection Issues

Problem: "Database connection not configured" error

Solution:

  1. Verify .env.local file exists in root directory
  2. Check NEON_DATABASE_URL is correctly formatted
  3. Ensure connection string includes ?sslmode=require
  4. Test connection: psql $NEON_DATABASE_URL -c "SELECT 1"

Build Errors

Problem: Build fails with TypeScript errors

Solution:

# Clear Next.js cache and rebuild
rm -rf .next
npm run build

Migration Fails

Problem: Migration fails with "relation already exists"

Solution: This is normal if tables already exist. The migrations use IF NOT EXISTS clauses and will skip existing structures.

Login Not Working

Problem: "Invalid credentials" despite correct password

Solution:

  1. Verify superadmin account exists:
    SELECT username, role FROM users WHERE username = 'superadmin';
  2. If issues persist, verify environment variables and database connectivity.

Slow Performance

Problem: Pages load slowly despite optimizations

Solution:

  1. Verify performance indexes are created:
    # Check if indexes exist
    psql $NEON_DATABASE_URL -c "\d+ progress_records"
  2. Run index migration if missing:
    • Super Admin β†’ Database β†’ Run Migration 013_add_performance_indexes.sql

πŸ§ͺ Development

Run Development Server

npm run dev

Run Tests

npm test

Build for Production

npm run build
npm start

Lint Code

npm run lint

Database Commands

# Setup database (run once)
npm run db:setup

# Run specific migration
psql $NEON_DATABASE_URL -f db/migrations/000_initial_setup.sql

# Check database schema
psql $NEON_DATABASE_URL -c "\dt"  # List tables
psql $NEON_DATABASE_URL -c "\d+ users"  # Describe table

πŸ“ API Documentation

Authentication

All API endpoints require JWT authentication via Authorization: Bearer <token> header.

Login:

POST /api/auth/login
Content-Type: application/json

{
  "username": "superadmin",
  "password": "admin123"
}

Response: { "token": "jwt_token_here", "user": {...} }

Key Endpoints

Endpoint Method Auth Description
/api/auth/login POST ❌ User login
/api/people/with-progress GET βœ… Fetch people with progress (optimized)
/api/people/bulk POST βœ… Bulk register converts
/api/milestones GET βœ… Get all milestones (cached 1hr)
/api/progress/[person_id] PUT βœ… Update milestone progress
/api/attendance/[person_id] POST βœ… Mark attendance
/api/groups GET βœ… List groups
/api/superadmin/users GET/POST βœ… (superadmin) User management

See inline code documentation for detailed API schemas.


🀝 Contributing

This is a proprietary project for First Love Church. For feature requests or bug reports, contact the development team.

Development Guidelines

  1. Follow TypeScript strict mode
  2. Use Ant Design components for consistency
  3. Write optimized database queries
  4. Test on mobile devices (PWA focus)
  5. Maintain WCAG AA color contrast compliance

πŸ“œ License

Proprietary Β© 2025 First Love Church (FLC). All rights reserved.

For Organizations Interested in Forking:

  1. Fork the repository
  2. Run the 000_initial_setup.sql migration on your Neon database
  3. Update branding in app/layout.tsx and public/manifest.json
  4. Customize milestones in Super Admin dashboard
  5. Deploy to Netlify/Vercel with your own environment variables

Support: For setup assistance, email your dev team or create an issue in the repository.


πŸ“ž Support


Built with ❀️ for First Love Church | Version 2.0 | October 2025

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors