Backend service for the Team1515 robotics team website, built with TypeScript, Firebase, and Vercel Serverless Functions. This service handles contact form submissions and newsletter subscriptions.
- TypeScript
- Firebase Admin SDK
- Vercel Serverless Functions
- Zod (Schema Validation)
- CORS
POST /api/contact
Handles contact form submissions with validation for:
- Name
- Subject
- Message
POST /api/newsletter
Manages newsletter subscriptions with:
- Email validation
- Duplicate subscription prevention
- Subscription status tracking
eam1515-backend/ ├── src/ │ └── lib/ │ └── firebase-admin.ts ├── api/ │ ├── contact/ │ │ └── index.ts │ └── newsletter/ │ └── index.ts ├── vercel.json ├── tsconfig.json └── package.json
- Node.js (v14 or higher)
- npm or yarn
- Firebase project
- Vercel CLI (optional for local development)
- Clone the repository
- Install dependencies:
npm install- Create a
.envfile with your Firebase credentials:
FIREBASE_PROJECT_ID=your-project-id
FIREBASE_PRIVATE_KEY=your-private-key
FIREBASE_CLIENT_EMAIL=your-client-emailRun the development server:
npm run devDeploy to Vercel:
npm run deployMake sure to set these in your Vercel project settings:
FIREBASE_PROJECT_IDFIREBASE_PRIVATE_KEYFIREBASE_CLIENT_EMAIL
- CORS enabled for secure cross-origin requests
- Input validation using Zod
- Firebase Admin SDK for secure database operations
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request