Full-stack demo Time Tracking application is built for performance and scale. It features a dynamic React frontend and a robust, stateless Java backend. Authentication with JWT tokens.
Authentication is managed by AWS Cognito, which handles secure, email-based user registration and authorization using JWT tokens. For the database, DynamoDB was chosen for its massive scalability and low-latency performance.
The entire architecture is stateless, a key design choice that allows the application to scale horizontally without limits. In a production environment, this enables it to work seamlessly behind a load balancer, such as AWS ALB, to ensure high availability and performance under heavy load. Java Vert.x framework for small memory footprint and fast performance.
- reacJavaFullStackApp/.vscode/launch.json
- Caddyfile included to simulate prod environment
A modern, responsive time tracking application built with React, TypeScript, and Material-UI. Users can track their daily work by project and task, with comprehensive reporting and analytics.
- User Authentication: Secure login/signup with AWS Cognito
- Task Management: Add, edit, and delete time tracking entries
- Project Organization: Group tasks by project for better organization
- Monthly Reports: Comprehensive analytics and reporting
- Responsive Design: Works on desktop and mobile devices
- Modern UI: Beautiful Material-UI interface
This app uses AWS Cognito for user authentication, providing:
- User registration and login
- Email verification
- Password reset functionality
- Secure session management
- User profile management
- Node.js (v14 or higher)
- npm or yarn
- AWS Account (for Cognito setup)
-
Clone the repository:
git clone <repository-url> cd react_timetracking
-
Install dependencies:
npm install
-
Set up AWS Cognito:
- Follow the instructions in AWS_COGNITO_SETUP.md
- Create a User Pool and App Client in AWS Cognito
- Get your User Pool ID and App Client ID
-
Configure environment variables:
cp env.example .env
Edit
.envand add your AWS Cognito configuration:REACT_APP_AWS_REGION=us-east-1 REACT_APP_COGNITO_USER_POOL_ID=your-user-pool-id REACT_APP_COGNITO_CLIENT_ID=your-app-client-id
-
Start the development server:
npm start
-
Open your browser: Navigate to http://localhost:3000
- Create an account: Click "Sign Up" and enter your details
- Verify your email: Check your email for a confirmation code
- Sign in: Use your username/email and password to log in
-
Add Tasks: Click "Add Task" to log your work
- Enter project name
- Describe the task
- Set the date
- Specify hours worked
-
View Reports: Click "Monthly Report" to see analytics
- Total hours worked
- Hours by project
- Task count and project count
-
Manage Tasks: Edit or delete existing tasks as needed
-
Sign Out: Use the "Sign Out" button to securely log out
src/
├── components/ # React components
│ ├── AuthWrapper.tsx # Authentication wrapper
│ ├── Login.tsx # Login form
│ ├── SignUp.tsx # Registration form
│ ├── ConfirmSignUp.tsx # Email verification
│ ├── ForgotPassword.tsx # Password reset
│ └── ConfirmForgotPassword.tsx # Password reset confirmation
├── contexts/ # React contexts
│ └── AuthContext.tsx # Authentication context
├── api.ts # API functions
├── aws-config.ts # AWS Amplify configuration
├── config.ts # App configuration
└── App.tsx # Main application component
The app uses the following environment variables:
REACT_APP_AWS_REGION: AWS region (e.g., us-east-1)REACT_APP_COGNITO_USER_POOL_ID: Cognito User Pool IDREACT_APP_COGNITO_CLIENT_ID: Cognito App Client ID
For detailed instructions on setting up AWS Cognito, see AWS_COGNITO_SETUP.md.
npm start: Start development servernpm build: Build for productionnpm test: Run testsnpm eject: Eject from Create React App
- New Components: Add to
src/components/ - API Functions: Add to
src/api.ts - Authentication: Use the
useAuthhook fromsrc/contexts/AuthContext.tsx
npm run buildFor production deployment:
- Update the domain in
src/aws-config.ts - Configure CORS settings in AWS Cognito
- Set up proper environment variables
- Use HTTPS in production
- Authentication errors: Check your AWS Cognito configuration
- Build errors: Ensure all dependencies are installed
- CORS errors: Configure allowed origins in Cognito
Enable debug logging by adding to src/aws-config.ts:
const awsConfig = {
Auth: {
// ... existing config
},
Logging: {
level: 'DEBUG'
}
};For issues and questions:
- Check the AWS_COGNITO_SETUP.md for authentication setup
- Review the troubleshooting section above
- Create an issue in the repository
- All authentication is handled securely through AWS Cognito
- Passwords are never stored locally
- Sessions are managed securely
- HTTPS is required in production
For more security information, see the AWS Cognito documentation.
This is a Java Vert.x server application that provides a REST API for task management with AWS DynamoDB storage and AWS Cognito User Pools authentication.
- REST API for CRUD operations on tasks
- AWS DynamoDB integration for data persistence
- AWS Cognito User Pools authentication
- JWT token validation
- Role-based access control
- Executable JAR with all dependencies included
- Java 17 or higher
- AWS account with DynamoDB and Cognito User Pools configured
- AWS credentials configured (via AWS CLI, environment variables, or IAM roles)
The application uses the following environment variables for AWS Cognito configuration:
-
COGNITO_USER_POOL_ID: Your AWS Cognito User Pool ID -
COGNITO_CLIENT_ID: Your AWS Cognito App Client ID -
AWS_REGION: AWS region (e.g., us-east-1) -
DYNAMODB_ENDPOINT=http://localhost:8000DynamoDB endpoint for dev env -
dev=trueDisables auhtentification for development in backend -
port=8888Vert.x server port and host -
host=localhost
./gradlew shadowJarThis creates an executable JAR file at build/libs/java_timetracking-1.0.0.jar
If you set dev=true environment variable, the backend will run without authentication:
java -jar build/libs/java_timetracking-1.0.0.jarSet the required environment variables and run: NB: in EC2 instance DYNAMODB_ENDPOINT not needed. Instance should have IAM role for DynamoDB access.
export COGNITO_USER_POOL_ID="your-user-pool-id"
export COGNITO_CLIENT_ID="your-client-id"
export AWS_REGION="us-east-1"
export DYNAMODB_ENDPOINT=http://localhost:8000
export port=80
export host=$(hostname -I)
java -jar build/libs/java_timetracking-1.0.0.jarAll API endpoints are prefixed with /api.
POST /api/auth/login- Authenticate user with username and password{ "username": "user@example.com", "password": "password" }
GET /api/tasks- List all tasksGET /api/tasks/:id- Get task by IDPOST /api/tasks- Create new taskPUT /api/tasks/:id- Update taskDELETE /api/tasks/:id- Delete task
{
"id": 1234567890,
"date": "2025-07-05",
"project": "Project Name",
"hours": 8,
"task": "Task description"
}- Login: Use the
/api/auth/loginendpoint with username and password - Get Token: The response includes an
idToken(JWT) - API Calls: Include the token in the Authorization header:
Authorization: Bearer <your-jwt-token>
- Create a Cognito User Pool in AWS Console
- Create an App Client in the User Pool
- Configure the App Client to allow USER_PASSWORD_AUTH
- Note down the User Pool ID and App Client ID
- Set up users in the User Pool
401 Unauthorized: Missing or invalid authentication token403 Forbidden: Insufficient permissions503 Service Unavailable: Authentication service not configured
./gradlew test./gradlew shadowJar -x test- MainVerticle: Main application entry point and HTTP server setup
- TaskService: Business logic for task operations with DynamoDB
- CognitoAuthService: AWS Cognito authentication and JWT validation
- AuthMiddleware: HTTP middleware for authentication and authorization
- DynamoDBClientProvider: AWS DynamoDB client configuration
- Vert.x Core and Web for HTTP server
- AWS SDK for DynamoDB and Cognito
- Auth0 JWT library for token validation
- Jackson for JSON processing
- JUnit 5 for testing
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html
In DynamoDB should exist table Tasks with primary key named "id"
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
MIT License Free to use unless reference to my homepage https://friendly-solution.com/ not removed ;)