A comprehensive student interaction tracking system with automated follow-up email scheduling for Launchpad Philly.
- Dual recipient selection for follow-up emails (student and staff)
- Immediate and scheduled email sending
- Automated daily cron job for scheduled emails
- Email tracking to prevent duplicates
- Gmail SMTP integration (with dev-mode console logging)
- Built-in AI assistant for summarization and insights
- Modern Next.js 15, Node 20 LTS, and pnpm 9.x stack
# Clone the repo and enter the directory
git clone <your-repo-url> Launchpad_Student_Form
cd Launchpad_Student_FormCopy the example environment file and edit it with your credentials:
cp .env.example .env.local
# Edit .env.local with your Gmail SMTP and DB settingsGmail SMTP setup:
- Enable 2-factor authentication on your Gmail account
- Generate an "App Password" from Google Account settings
- Use the App Password as
EMAIL_PASSWORDin.env.local
docker compose up --build- App: http://localhost:3000
- DB: localhost:5432 (user: postgres, password: postgres, db: launchpad)
docker compose exec app pnpm prisma migrate deploydocker compose downdocker compose run --rm seedNotes:
- The
.envfile at the project root is used for all secrets/configuration (not copied into the image, but loaded at runtime). - If you change
.envor seed data, run:docker compose down -v docker compose up
- For troubleshooting, check logs:
docker compose logs seed
If you want Docker to manage the daily follow-up email job, use the built-in cron service:
- Make sure the
cronservice is enabled indocker-compose.yml(already set up). - The cron container will run the follow-up script every day at 7am (container time).
- Logs are written to
/var/log/cron.loginside the container.
docker compose exec cron tail -n 50 /var/log/cron.logdocker compose exec cron node /app/scripts/send-scheduled-followups-docker.jsNote:
- The cron job uses the same environment variables as the app (from
.env). - You can still run the script on your host with your system's cron if you prefer.
pnpm installnpx prisma db push
npx prisma generatepnpm devapp/create/components/FollowUpCard.tsx: Dual checkbox UI for recipient selectionapp/create/form.tsx: Main form for follow-up data
app/api/interactions/route.ts: API for creating interactionsapp/api/followup-cron/route.ts: Cron endpoint for scheduled emailsscripts/send-scheduled-followups.js: Node.js cron script for email automationlib/email.ts: Email utility with templates
followUpRequired BOOLEAN DEFAULT false
followUpDate TEXT
followUpOverdue BOOLEAN DEFAULT false
followUpSent BOOLEAN DEFAULT false
followUpStudent BOOLEAN DEFAULT false
followUpStaff BOOLEAN DEFAULT false
followUpStudentEmail TEXT
followUpStaffEmail TEXTPOST /api/interactions
{
"studentName": "John Doe",
"studentId": "0001",
"type": "Coaching",
"reason": "Academic Support",
"notes": "Student needs help with math",
"followUp": {
"required": true,
"student": true,
"staff": true,
"date": "2025-06-10",
"studentEmail": "student@example.com",
"staffEmail": "staff@example.com"
}
}POST /api/followup-cron
// Returns: { "success": true, "sentCount": 5 }If email credentials aren't configured, emails are logged to the console:
[EMAIL] Would send follow-up to student <student@example.com> for interaction #123
[EMAIL] Subject: Scheduled Follow-up Reminder
[EMAIL] Content:
Hello John,
...
Test email functionality with configured credentials:
curl -X POST http://localhost:3000/api/followup-cronSubject: Scheduled Follow-up Reminder
Hello [Name],
This is a reminder for your scheduled follow-up.
Session Details:
- Student: John Doe
- Program: foundations
- Type: Coaching
- Reason: Academic Support
- Notes: Student needs help with math
- Follow-up Date: 2025-06-10
Best regards,
Launchpad Student Services
- SQL Diagram: https://dbdiagram.io/d/682b4fb41227bdcb4effdfdb
- Wireframe: https://excalidraw.com/#json=LBfreDwmu2HOgaCv66uJ6,WVSCjOagw48yEX7IkCDiyA
- Notion Doc: https://www.notion.so/Launchpad-Form-1f860add3da980f2bd36c658a18d50db?pvs=4
- Project Board: https://github.com/users/AD-Archer/projects/18
- The app expects environment variables for DB and email config. Copy
.env.exampleto.env.localand edit as needed. - For production, you can use the same Docker setup and provide production-ready environment variables.
- The Dockerfile uses Node 20 LTS and pnpm 9.x for best compatibility with the current codebase.
- If you need to customize the database, add more services, or have questions about deploying to cloud providers, reach out to the maintainer.
Below is a sample of the actual .env file used in production. Never commit your real secrets to version control.
DATABASE_URL="postgresql://user:password@host:5432/dbname"
JWT_SECRET="your-jwt-secret"
NEXTAUTH_SECRET="your-nextauth-secret"
NEXTAUTH_URL="http://localhost:3000"
VERCEL_OIDC_TOKEN="<your-vercel-oidc-token>"
PLAYLAB_API_KEY="sk-pl-EXAMPLE"
PLAYLAB_PROJECT_ID="projectid"
OPENAI_API_KEY='sk-EXAMPLE'
EMAIL_FROM="noreply@example.com"
EMAIL_PASSWORD="your-app-password"
EMAIL_HOST="smtp.example.com"
EMAIL_PORT="587"
EMAIL_SECURE="false"Gmail Setup Notes:
- Enable 2-factor authentication on your Gmail account
- Generate an "App Password" (not your regular password)
- Use that app password as
EMAIL_PASSWORD - Google App Password Instructions








