A fully functional serverless task management application built with AWS services and vanilla JavaScript.
This project demonstrates a complete serverless architecture with:
- User Authentication using AWS Cognito
- REST API with AWS API Gateway
- Serverless Functions using AWS Lambda
- NoSQL Database with AWS DynamoDB
- JWT Token Security for API authorization
┌─────────────┐
│ Browser │
│ (Frontend) │
└──────┬──────┘
│
│ 1. Login Request
▼
┌─────────────────┐
│ AWS Cognito │ ──► Returns JWT Token
└─────────────────┘
│
│ 2. API Request (with JWT)
▼
┌─────────────────┐
│ API Gateway │ ──► Validates JWT
└────────┬────────┘
│
│ 3. Invoke Function
▼
┌─────────────────┐
│ Lambda │ ──► Process Request
└────────┬────────┘
│
│ 4. Store/Retrieve Data
▼
┌─────────────────┐
│ DynamoDB │ ──► Return Data
└─────────────────┘
- ✅ User registration and login
- ✅ Secure JWT-based authentication
- ✅ Create tasks with title, description, and priority
- ✅ View all user tasks
- ✅ Delete tasks
- ✅ Real-time UI updates
- ✅ Responsive design
- ✅ Error handling and user feedback
serverless-app/
├── index.html # Main application UI
├── styles.css # Application styling
├── app.js # Frontend logic and API calls
├── config.js # AWS configuration
├── IMPLEMENTATION_GUIDE.md # Detailed setup guide
├── lambda-functions/
│ ├── createTask.js # Lambda: Create task
│ ├── getTasks.js # Lambda: Get tasks
│ └── deleteTask.js # Lambda: Delete task
└── README.md # This file
- HTML5
- CSS3 (with modern flexbox and animations)
- Vanilla JavaScript (ES6+)
- AWS Cognito: User authentication and management
- AWS API Gateway: REST API management
- AWS Lambda: Serverless compute (Node.js)
- AWS DynamoDB: NoSQL database
- AWS IAM: Role-based access control
Before you begin, ensure you have:
- AWS Account (Free Tier eligible)
- Basic knowledge of:
- HTML/CSS/JavaScript
- REST APIs
- AWS Console navigation
- Web browser
- Text editor (VS Code recommended)
# Download all project files to a directory
mkdir serverless-task-manager
cd serverless-task-managerFollow the detailed instructions in IMPLEMENTATION_GUIDE.md:
-
Create DynamoDB Table
- Table name:
TasksTable - Partition key:
userId(String) - Sort key:
taskId(String)
- Table name:
-
Create Cognito User Pool
- Enable email sign-in
- Create app client
- Note User Pool ID and Client ID
-
Create Lambda Functions
- Deploy
createTask.js - Deploy
getTasks.js - Deploy
deleteTask.js(optional) - Add DynamoDB permissions
- Deploy
-
Create API Gateway
- Create REST API
- Add Cognito authorizer
- Create
/tasksresource - Add POST and GET methods
- Enable CORS
- Deploy to
prodstage
Update config.js with your AWS values:
const AWS_CONFIG = {
cognito: {
userPoolId: 'YOUR_USER_POOL_ID',
clientId: 'YOUR_CLIENT_ID',
region: 'YOUR_REGION'
},
api: {
endpoint: 'YOUR_API_GATEWAY_URL',
stage: 'prod'
}
};Option 1: Python HTTP Server
python3 -m http.server 8000Option 2: Node.js HTTP Server
npx http-server -p 8000Option 3: VS Code Live Server
- Install Live Server extension
- Right-click
index.html - Select "Open with Live Server"
Open http://localhost:8000 in your browser.
-
Sign Up
- Click "Sign Up" link
- Enter email and strong password
- Submit form
- Check email for verification (if enabled)
-
Login
- Enter credentials
- Click "Login"
- Verify redirect to task page
-
Create Task
- Fill in task details
- Select priority
- Click "Add Task"
- Verify task appears in list
-
View Tasks
- See all your tasks displayed
- Each task shows title, description, priority, and date
- Click "Refresh" to reload tasks
-
Delete Task
- Click "Delete" button
- Confirm deletion
- Verify task is removed
-
Logout
- Click "Logout" button
- Verify return to login page
Problem: Login/Signup fails
- Verify Cognito User Pool ID and Client ID in
config.js - Check password meets requirements (min 8 chars, uppercase, lowercase, number)
- Look at browser console for detailed errors
Problem: Tasks not loading
- Verify API Gateway URL in
config.js - Check API Gateway has Cognito authorizer enabled
- Review Lambda CloudWatch logs for errors
- Ensure CORS is enabled on all methods
Problem: CORS errors
- Enable CORS on all API Gateway methods
- Redeploy API after enabling CORS
- Check Lambda functions return CORS headers
Problem: Unauthorized errors
- Verify JWT token is being sent in Authorization header
- Check token hasn't expired (tokens typically last 1 hour)
- Re-login to get fresh token
Browser Console
Press F12 → Console tab
Check for JavaScript errors
Network Tab
F12 → Network tab
Filter by XHR/Fetch
Check request/response details
AWS CloudWatch
AWS Console → CloudWatch → Log groups
Check /aws/lambda/CreateTask logs
Check /aws/lambda/GetTasks logs
- Login Page: Show login form
- Task Creation: Show task form with data and success message
- Task List: Show multiple tasks displayed with details
All API requests require a JWT token in the Authorization header:
Authorization: Bearer <JWT_TOKEN>
POST /tasks
Content-Type: application/json
Authorization: Bearer <token>
Body:
{
"title": "Task title",
"description": "Task description",
"priority": "high|medium|low"
}
Response: 201 Created
{
"message": "Task created successfully",
"task": { ... }
}
GET /tasks
Authorization: Bearer <token>
Response: 200 OK
{
"tasks": [...],
"count": 5
}
DELETE /tasks/{taskId}
Authorization: Bearer <token>
Response: 200 OK
{
"message": "Task deleted successfully",
"taskId": "..."
}
- ✅ JWT token-based authentication
- ✅ Cognito User Pool for user management
- ✅ API Gateway authorizer validates all requests
- ✅ Tasks are user-specific (userId isolation)
- ✅ HTTPS for all API communications
- ✅ Input validation on both frontend and backend
By completing this project, you will learn:
- Serverless Architecture: Understanding of serverless design patterns
- AWS Services: Hands-on experience with core AWS services
- REST API Design: Building and consuming RESTful APIs
- Authentication: JWT token-based authentication flow
- Frontend Integration: Connecting frontend to backend APIs
- Security: Implementing secure API authorization
- NoSQL Databases: Working with DynamoDB
Possible improvements to extend the project:
- Update task functionality
- Mark tasks as complete/incomplete
- Filter tasks by status or priority
- Search functionality
- Task categories or tags
- Due dates and reminders
- File attachments
- User profile management
- Dark mode
- Progressive Web App (PWA) support
This project is for educational purposes.
If you encounter issues:
- Review the
IMPLEMENTATION_GUIDE.md - Check the Troubleshooting section
- Review AWS CloudWatch logs
- Check browser console for errors
Created as an educational project for serverless architecture demonstration.
Good luck with your serverless journey! 🚀