A Next.js web application that allows users to search for hackathons and automatically sync their schedules to Google Calendar.
- Google OAuth 2.0 Authentication - Sign in with Google to access Calendar features
- Email/Password Authentication - Alternative login method using credentials
- Hackathon Search - Search for hackathons by name
- Schedule Retrieval - Automatically fetch hackathon event schedules
- Google Calendar Integration - Add all events to your Google Calendar with one click
- Beautiful UI - Modern, responsive design with Tailwind CSS
- Framework: Next.js 14 (App Router)
- Authentication: NextAuth.js
- Styling: Tailwind CSS
- Calendar API: Google Calendar API (googleapis)
- Language: TypeScript
Before you begin, ensure you have:
- Node.js 18+ installed
- A Google Cloud Platform account
- npm or yarn package manager
git clone <repository-url>
cd hackathon-calendarnpm install
# or
yarn installTo enable Google sign-in and Calendar access, you need to create OAuth credentials:
-
Go to Google Cloud Console
-
Create a new project or select an existing one
-
Enable the following APIs:
- Google Calendar API
- Google+ API (for user info)
-
Configure OAuth consent screen:
- Go to APIs & Services > OAuth consent screen
- Choose External user type
- Fill in the required fields:
- App name: "Hackathon Calendar"
- User support email: your email
- Developer contact: your email
- Add scopes:
.../auth/userinfo.email.../auth/userinfo.profile.../auth/calendar(Google Calendar access)
- Add test users if in testing mode
-
Create OAuth credentials:
- Go to APIs & Services > Credentials
- Click Create Credentials > OAuth client ID
- Application type: Web application
- Name: "Hackathon Calendar Web Client"
- Authorized redirect URIs:
http://localhost:3000/api/auth/callback/googlehttps://your-production-domain.com/api/auth/callback/google(for production)
- Click Create
- Copy your Client ID and Client Secret
Create a .env.local file in the root directory:
cp .env.example .env.localEdit .env.local and add your credentials:
# NextAuth Configuration
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=your-secret-key-here
# Google OAuth Credentials
GOOGLE_CLIENT_ID=your-google-client-id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your-google-client-secretTo generate a secure NEXTAUTH_SECRET:
openssl rand -base64 32npm run dev
# or
yarn devOpen http://localhost:3000 in your browser.
-
With Google:
- Click "Sign in with Google"
- Grant calendar permissions
- You'll be able to add events to your Google Calendar
-
With Email/Password:
- Enter any email
- Use password:
password123(demo) - Note: Calendar features require Google sign-in
- Enter a hackathon name in the search bar
- Try these examples:
- "MLH Hackathon"
- "HackMIT"
- "TreeHacks"
- View the schedule of events
- After searching, click "Add to Google Calendar"
- All events will be added to your primary calendar
- You'll receive a confirmation message
hackathon-schedule/
├── app/
│ ├── api/
│ │ ├── auth/
│ │ │ └── [...nextauth]/
│ │ │ └── route.ts # NextAuth configuration
│ │ ├── search/
│ │ │ └── route.ts # Hackathon search API
│ │ └── add-to-calendar/
│ │ └── route.ts # Calendar integration API
│ ├── auth/
│ │ └── signin/
│ │ └── page.tsx # Sign-in page
│ ├── layout.tsx # Root layout
│ ├── page.tsx # Home page
│ ├── providers.tsx # Context providers
│ └── globals.css # Global styles
├── components/
│ ├── SearchBar.tsx # Search input component
│ └── EventsList.tsx # Events display component
├── lib/
│ └── google-calendar.ts # Google Calendar utilities
├── types/
│ └── next-auth.d.ts # NextAuth type extensions
├── .env.example # Environment variables template
├── .env.local # Your local environment variables
├── next.config.js # Next.js configuration
├── tailwind.config.js # Tailwind CSS configuration
├── tsconfig.json # TypeScript configuration
└── package.json # Project dependencies
Search for a hackathon and retrieve its schedule.
Request:
{
"query": "MLH Hackathon"
}Response:
{
"hackathonName": "MLH Hackathon 2024",
"events": [
{
"title": "Opening Ceremony",
"description": "Welcome address and event kickoff",
"startDateTime": "2024-11-15T18:00:00-05:00",
"endDateTime": "2024-11-15T19:00:00-05:00"
}
]
}Add events to Google Calendar.
Request:
{
"hackathonName": "MLH Hackathon 2024",
"events": [...],
"calendarId": "primary"
}Response:
{
"success": true,
"addedCount": 7,
"message": "Successfully added 7 events to your Google Calendar!"
}Get list of user's calendars.
Response:
{
"calendars": [
{
"id": "primary",
"summary": "My Calendar"
}
]
}- User clicks "Sign in with Google"
- NextAuth redirects to Google's OAuth consent screen
- User grants permissions (profile + calendar access)
- Google redirects back with authorization code
- NextAuth exchanges code for access token
- Access token stored in session (via JWT)
- Token used for subsequent Calendar API calls
The application uses the Google Calendar API to:
- Validate tokens - Ensure the user's access token is valid
- Retrieve calendars - Get list of user's calendars
- Insert events - Add hackathon events to calendar
Key files:
lib/google-calendar.ts- Utility functions for Calendar APIapp/api/add-to-calendar/route.ts- API route handling calendar operations
-
Real Web Scraping
- Integrate Puppeteer or Cheerio for live scraping
- Parse Devpost hackathon pages
- Extract schedules from official websites
- Handle various date/time formats
-
Advanced Features
- Choose which calendar to add events to
- Customize event reminders
- Batch processing for multiple hackathons
- Event conflict detection
- Calendar sync status tracking
-
Database Integration
- Store user preferences
- Cache hackathon schedules
- Track added events
- User history
-
Enhanced UI
- Calendar preview before adding
- Event customization
- Timezone selection
- Mobile app
- Push your code to GitHub
- Go to Vercel
- Import your repository
- Add environment variables:
NEXTAUTH_URL(your production URL)NEXTAUTH_SECRETGOOGLE_CLIENT_IDGOOGLE_CLIENT_SECRET
- Update Google OAuth redirect URIs with your production URL
- Deploy!
- Update
NEXTAUTH_URLto your production domain - Add production URL to Google OAuth authorized redirect URIs
- Keep your secrets secure and never commit them to version control
"Unauthorized - Please sign in"
- Make sure you're signed in
- Check that your session hasn't expired
"Google sign-in required"
- Sign out and sign back in with Google
- Email/password auth doesn't support Calendar features
"Access token is invalid or expired"
- Sign out and sign back in
- Check Google OAuth credentials are correct
No events found
- Try the example hackathon names
- Check spelling of hackathon name
- Note: Only mock data is available in current version
Events not added to calendar
- Verify Google Calendar API is enabled
- Check OAuth scopes include calendar access
- Ensure you granted calendar permissions during sign-in
Currently, the application uses mock data for hackathon schedules. The following hackathons are available:
- "MLH Hackathon"
- "HackMIT"
- "TreeHacks"
To add real scraping, implement the scraping logic in app/api/search/route.ts.
Never commit .env.local to version control. Always use .env.example as a template.
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
MIT License - feel free to use this project for your own purposes.
For issues or questions:
- Open an issue on GitHub
- Check the troubleshooting section
- Review Google Calendar API documentation
- Built with Next.js
- Authentication by NextAuth.js
- Styled with Tailwind CSS
- Calendar integration via Google Calendar API
Made with ❤️ for hackathon enthusiasts