StreamIt is a simple social application built using Quarkus and JavaScript that allows users to create posts of up to 140 characters and view them in a single streaming feed. The backend service is deployed as a monolithic application and can be later split into microservices using AWS Lambda. User authentication and security are managed with JWT and AWS Cognito.
- User Registration: Users can register with their name, email, and password.
- Login & Authentication: Users can log in and access protected features with JWT.
- Post Creation: Authenticated users can create posts up to 140 characters.
- Post Streaming: All posts are displayed in a live stream ordered by timestamp.
- Secure API: Endpoints are protected with JWT, generated by AWS Cognito.
- Scalable Architecture: The application can be separated into microservices and deployed on AWS Lambda.
- Java 11+
- Quarkus Framework
- Maven
- AWS CLI (for deployment on S3 and Lambda)
- AWS Cognito (for authentication and JWT)
- Docker (optional, for containerized deployments)
- src/main/java: Contains the Java code for the Quarkus backend.
- src/main/resources: Contains HTML, JavaScript, and static assets.
- controllers: REST API controllers for managing users, posts, and streams.
- entities: JPA entities representing Users and Posts.
- repositories: Repositories for accessing User and Post data.
git clone https://github.com/JohannBulls/StreamIt.git
cd StreamIt- Create a Cognito User Pool on AWS.
- Configure app clients and enable user authentication with email and password.
- Update the BASE_URL in
app.jsand backend to match your Cognito credentials and endpoint.
To start the application locally, run the following commands:
./mvnw compile quarkus:devThe application should be running on http://localhost:8080.
To deploy the frontend application on S3:
- Create an S3 bucket with public access for hosting a static website.
- Upload
index.html,app.js, and other assets to the bucket. - Configure the bucket for static website hosting and note the endpoint URL.
Configure AWS Cognito to issue JWTs for user authentication:
- Update the /auth/login endpoint in
app.jsto authenticate with Cognito. - Configure protected endpoints to validate tokens from AWS Cognito.
- Refactor the monolithic application into three microservices:
- User Service
- Post Service
- Stream Service
- Deploy each service as an AWS Lambda function.
- Configure API Gateway to route requests to Lambda functions.
| Endpoint | HTTP Method | Description |
|---|---|---|
/users |
GET | Retrieve all users |
/users |
POST | Register a new user |
/users/{id} |
GET | Get user details by ID |
/posts |
GET | Retrieve all posts |
/posts |
POST | Create a new post |
/posts/{id} |
GET | Get post details by ID |
/stream |
GET | Get a stream of all posts ordered by timestamp |
- Register a New User: Collects user information and sends it to the
/usersendpoint. - Login: Authenticates user credentials and stores the JWT token.
- Create Post: Allows the user to create a new post of up to 140 characters.
- Stream Feed: Displays a feed of all posts in real-time.
- Register: Go to the "Register" form and create a new user.
- Login: Log in with your email and password to receive a token.
- Create a Post: Submit a new post via the "Create Post" form.
- View Stream: See the live stream of posts in the "Stream" section.
Test the application locally with the following tools:
- Postman: Test each endpoint with JWT tokens.
- Frontend UI: Interact with the forms and validate the application flow.
- AWS Console: Test deployed Lambda functions and API Gateway setup.
The application follows a monolithic architecture in the initial setup with Quarkus and then transitions to a microservices architecture with AWS Lambda. The architecture consists of the following components:
- API Gateway: Routes requests to microservices in Lambda.
- AWS Cognito: Manages user authentication and issues JWT tokens.
- AWS S3: Hosts the static frontend for public access.
- Microservices: User, Post, and Stream services deployed independently on Lambda.
This project is licensed under the MIT License - see the LICENSE file for details.
