This application provides a common platform where grantees can apply to multiple grant programs in one place, instead of visiting each organization's website individually. A user selects the organizations they want to apply to, and the app forwards their data to the specific grant programs.
Security Note: This application includes Google reCAPTCHA v2 to prevent bot submissions and ensure application authenticity.
The system is designed to be flexible and extensible, allowing for different organizations with their own application workflows and field requirements.
-
Organization Configuration
- Each organization has its own configuration in
config/organizations.ts
- Organizations can specify their workflow type, field mappings, and other settings
- Each organization has its own configuration in
-
Field Definitions
- Field definitions are centralized in
config/fieldDefinitions.ts
- Each field specifies which organizations use it
- The system dynamically shows only the fields relevant to selected organizations
- Field definitions are centralized in
-
Workflow Handlers
- Different workflow types (API, Google Form, Email) have their own handlers
- Handlers are implemented in
app/api/submit/route.ts
- Each handler knows how to format and submit data for its workflow type
-
Field Mapping
- Organizations can define mappings between common fields and their specific field names
- This allows for field reuse across organizations with different naming conventions
The system supports multiple workflow types:
-
API-based Workflow
- Submits data to an organization's API endpoint
- Used by OpenSats
-
Google Form Workflow
- Submits data to a Google Form
-
Email Workflow
- Sends application data via email
- Used by Maelstrom, Brink, Spiral, and Btrust
-
Custom Workflow
- For organizations with unique requirements
- Implemented through custom handler functions
To add a new organization:
- Update
config/organizations.ts
with the organization's details - Configure the appropriate
workflowType
andworkflowConfig
- Add any organization-specific fields to
config/fieldDefinitions.ts
- Set
workflowImplemented: true
when ready to accept applications
{
id: 'example-org',
name: 'Example Organization',
description: 'An example organization using API workflow',
website: 'https://example.org',
logo: '/logos/example.png',
active: true,
workflowImplemented: true,
workflowType: 'api',
workflowConfig: {
apiUrl: 'https://api.example.org/applications',
apiHeaders: {
'Authorization': `Bearer ${process.env.EXAMPLE_API_KEY}`
}
},
fieldMapping: {
'name': 'applicant_name'
}
}
{
id: 'form-org',
name: 'Form Organization',
description: 'An example organization using Google Form workflow',
website: 'https://form-org.example',
logo: '/logos/form-org.png',
active: true,
workflowImplemented: true,
workflowType: 'googleForm',
workflowConfig: {
formUrl: 'https://docs.google.com/forms/d/e/YOUR_FORM_ID/formResponse',
formFields: {
'email': 'entry.123456789',
'your_name': 'entry.987654321'
}
}
}
{
id: 'email-org',
name: 'Email Organization',
description: 'An example organization using email-based workflow',
website: 'https://email-org.example',
logo: '/logos/email-org.png',
active: true,
workflowImplemented: true,
workflowType: 'email',
workflowConfig: {
emailRecipients: ['[email protected]', '[email protected]'],
emailSubject: 'New Grant Application Submission'
},
fieldMapping: {
'your_name': 'applicant_name'
}
}
To add a new field:
- Add the field definition to
config/fieldDefinitions.ts
- Specify which organizations use this field
- The field will automatically appear for users who select those organizations
- Node.js 16+
- npm or yarn
- Clone the repository
- Install dependencies:
npm install
- Set up environment variables (copy
.env.local.example
to.env.local
) - Set up Google reCAPTCHA v2:
- Go to https://www.google.com/recaptcha/admin/create
- Create a new reCAPTCHA v2 site (choose "I'm not a robot" Checkbox)
- Add your domain (localhost:3000 for development)
- Copy the Site Key and Secret Key to your
.env.local
file
- Run the development server:
npm run dev
reCAPTCHA Configuration (Required)
NEXT_PUBLIC_RECAPTCHA_SITE_KEY
: Your Google reCAPTCHA v2 Site Key (public, used in frontend)RECAPTCHA_SECRET_KEY
: Your Google reCAPTCHA v2 Secret Key (private, used in backend)
Application Configuration
OPENSATS_API_URL
: API endpoint for OpenSatsOPENSATS_API_KEY
: API key for OpenSatsOPENSATS_EMAIL_RECIPIENTS
: Comma-separated list of email recipients for OpenSats applicationsSENDGRID_API_KEY
: SendGrid API key for sending emails directly (used by Brink and other email-based workflows)SENDGRID_VERIFIED_SENDER
: Verified sender email address for SendGrid (required for all email workflows)SENDGRID_API_URL
: API endpoint for OpenSats' SendGrid integration (only used for OpenSats)BRINK_EMAIL_RECIPIENTS
: Comma-separated list of email recipients for Brink applicationsSPIRAL_EMAIL_RECIPIENTS
: Comma-separated list of email recipients for Spiral applicationsBTRUST_EMAIL_RECIPIENTS
: Comma-separated list of email recipients for Btrust applicationsMAELSTROM_EMAIL_RECIPIENTS
: Comma-separated list of email recipients for Maelstrom applications