{"id":24625412,"url":"https://github.com/shahrambarai/qa-platform","last_synced_at":"2026-04-09T09:53:56.939Z","repository":{"id":273369474,"uuid":"919441314","full_name":"shahramBarai/QA-Platform","owner":"shahramBarai","description":"A scalable Q\u0026A web application designed for coursework discussions, featuring real-time caching, LLM-generated answers, end-to-end testing, and performance optimization. Built with Astro, Svelte, Deno, PostgreSQL, and Redis.","archived":false,"fork":false,"pushed_at":"2025-01-20T13:32:16.000Z","size":48,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-20T14:34:56.521Z","etag":null,"topics":["deno","docker","e2e-testing","llm-integration","optimization","performance-testing","q-and-a","redis-cache","scalable-web-app","svel","tailwindcss"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shahramBarai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-20T11:53:14.000Z","updated_at":"2025-01-20T13:32:18.000Z","dependencies_parsed_at":"2025-01-20T14:46:53.526Z","dependency_job_id":null,"html_url":"https://github.com/shahramBarai/QA-Platform","commit_stats":null,"previous_names":["shahrambarai/qa-platform"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahramBarai%2FQA-Platform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahramBarai%2FQA-Platform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahramBarai%2FQA-Platform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahramBarai%2FQA-Platform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shahramBarai","download_url":"https://codeload.github.com/shahramBarai/QA-Platform/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244394469,"owners_count":20445634,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deno","docker","e2e-testing","llm-integration","optimization","performance-testing","q-and-a","redis-cache","scalable-web-app","svel","tailwindcss"],"created_at":"2025-01-25T04:33:52.260Z","updated_at":"2025-12-31T00:11:31.972Z","avatar_url":"https://github.com/shahramBarai.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Q\u0026A Platform\n\n_\\*This project is part of Aalto University's Designing and Building Scalable Web Applications course (completed in spring 2024)._\n\nThis project is a Question and Answer web application designed for coursework discussions. It allows users to:\n\n- **View** courses and **post questions** related to those courses\n- **Provide** answers (including **LLM-generated** answers)\n- **Upvote** questions and answers to surface the most helpful content\n- **Cache** frequently accessed data for improved performance\n\nThe system demonstrates **scalability** and best practices, integrating **multiple services**, **caching**, **end-to-end testing**, and **performance testing**.\n\n## Features\n\n1. **Database**\n\n   - Uses **PostgreSQL** for structured data storage (courses, questions, answers, likes).\n   - Flyway manages schema migrations under [flyway/sql](flyway/sql/).\n\n2. **Caching**\n\n   - Incorporates **Redis** to cache frequent queries (like listing questions/answers).\n   - Utilizes **separate Redis databases**:\n     - **DB 0**: Caches question and answer data.\n     - **DB 1**: Manages rate-limiting keys to enforce user posting limits.\n   - Flushing strategies ensure data remains fresh when new questions or answers are added without affecting rate limits.\n\n3. **End-to-End Tests**\n\n   - Uses **Playwright** to confirm the UI flows (home page, course page, question page) function correctly.\n   - Tests are located in [e2e-playwright/tests](e2e-playwright/tests/).\n\n4. **Performance Tests**\n\n   - Leverages **k6** scripts in the [k6/](k6/) folder to measure and optimize performance under various load scenarios.\n\n5. **User Interactions**\n\n   - Upvoting logic for questions and answers via join tables in the database (`questionLike`, `answerLike`).\n\n6. **Styling \u0026 Framework**\n\n   - The UI is built with **Astro**, **Svelte**, and **TailwindCSS** for a modern, efficient front-end.\n   - The back-end uses **Deno** for the `qa-api` service, with a focus on simplicity and performance.\n\n7. **Rate Limiting**\n\n   - Enforces that a **single user** (identified by `userUuid`) can post **at most one question and one answer per minute**.\n   - Implemented using a **separate Redis database** to manage rate-limiting without interfering with cached data.\n\n8. **Separate Configurations for Development and Production**\n   - Docker setups ([docker-compose.yml](docker-compose.yml) for dev, [docker-compose.prod.yml](docker-compose.prod.yml) for production) to demonstrate how the app scales in different environments.\n\n## Project Structure\n\nA brief overview of the main directories (subject to change as the project evolves):\n\n```plaintext\n├── e2e-playwright\n│   └── tests/                  # End-to-end tests (Playwright)\n├── flyway\n│   └── sql/                    # Database migration scripts (Flyway)\n├── k6                          # Performance testing scripts (k6)\n├── llm-api                     # LLM API client for generating answers\n├── nginx                       # NGINX configuration for routing\n├── qa-api\n│   ├── controllers             # API controllers for courses, questions, answers, users\n│   ├── database                # PostgreSQL interactions for Deno\n│   ├── services                # Business logic (caching, LLM calls, etc.)\n│   └── util                    # Utility functions (cache proxies, etc.)\n├── qa-ui                       # User interface (Astro, Svelte and Tailwind)\n├── redis                       # Redis configuration (redis.conf)\n├── docker-compose.prod.yml     # Production Docker Compose setup\n├── docker-compose.yml          # Development Docker Compose setup\n├── DATABASE.md                 # Database schema and caching strategy\n├── PERFORMANCE_TEST_RESULTS.md # Performance testing results\n├── REFLECTION.md               # Key design decisions and potential improvements\n├── RUNNING.md                  # Deployment and testing instructions\n└── README.md                   # This file\n```\n\n## Deployment and Testing\n\nFor details on deploying the application locally, along with instructions for running the end-to-end tests and performance tests, see [RUNNING.md](RUNNING.md). This file outlines:\n\n- How to run the application in **development mode** with Docker Compose,\n- How to migrate and start the system in **production mode**,\n- How to invoke **Playwright E2E tests** in Docker,\n- How to launch **k6 performance tests**.\n\nMy performance testing results can be found in [PERFORMANCE.md](PERFORMANCE.md).\n\n## Database Schema\n\nA short discussion of the applications database schema and caching strategy can be found in [DATABASE.md](DATABASE.md).\n\n## Reflection\n\nA short discussion of the application’s **key design decisions** (e.g., normalized database schema, caching approach, LLM integration) and **potential improvements** for performance can be found in [REFLECTION.md](REFLECTION.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshahrambarai%2Fqa-platform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshahrambarai%2Fqa-platform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshahrambarai%2Fqa-platform/lists"}