A 'Star Wars' inspired Vite + React Shop for Gray Team Competition
Built with the tools and technologies:
Shop is a powerful collaborative platform designed for gray teams participating in the CDT competition, enabling seamless management of a virtual shop.
Why Shop?
This project enhances teamwork and streamlines e-commerce operations. The core features include:
- 🛠️ Collaborative Platform: Facilitates teamwork among members, ensuring coordinated efforts in a competitive environment.
- 🔒 User Authentication: Secure login and registration processes enhance user experience and protect sensitive data.
- ⚙️ Robust Backend Architecture: Utilizes Express and PostgreSQL for efficient server-side operations and data management.
- 🎨 Dynamic Frontend: Built with React and Vite, ensuring a responsive and engaging user interface.
- 🚀 Error Handling: Graceful error management improves application stability and keeps users informed.
- 📦 Inventory Management: Streamlined processes for product retrieval and purchase transactions enhance the shopping experience.
| Component | Details | |
|---|---|---|
| ⚙️ | Architecture |
|
| 🔩 | Code Quality |
|
| 📄 | Documentation |
|
| 🔌 | Integrations |
|
| 🧩 | Modularity |
|
| 🧪 | Testing |
|
| ⚡️ | Performance |
|
| 🛡️ | Security |
|
| 📦 | Dependencies |
|
| 🚀 | Scalability |
|
This project includes an automated PostgreSQL setup using Ansible in the db_setup/ directory.
The Ansible playbook:
- Installs required system dependencies (e.g.,
bash,openssl,libssl-dev) on Debian-based systems. - Installs PostgreSQL and tools:
postgresqlpostgresql-contriblibpq-devpython3-psycopg2
- Ensures the PostgreSQL service is running and enabled at boot.
- Creates the application database using variables (e.g.,
db_name,db_user,db_password). - Grants the application user the appropriate privileges on that database.
- Copies the SQL initialization script
init_db.sqlto the target host and runs it as thepostgresuser.
The init_db.sql script creates and seeds the core tables used by the Shop application:
-
products- Stores available items in the Gray Team shop.
- Columns:
id,name,price,image,description. - Preloaded with Star Wars–themed products such as Fire Cannons!, Repair Droids, Mind Probe, Force Barrier, and A Darth Wager.
-
users- Stores team login credentials.
- Columns:
username,password. - Seeded users:
blue_team_1,blue_team_2,red_team,gray_team.
-
purchases- Tracks what each team buys and when.
- Columns:
purchase_id,user_id,product_id,quantity,purchase_date.
-
inventory- Enforces limited stock per product (e.g.,
quantity <= 10). - Columns:
product_id,quantity.
- Enforces limited stock per product (e.g.,
-
team_credits- Manages starting and current credits for each team.
- Columns:
username,starting_credit,current_credit.
Together, the Ansible role and SQL initialization script allow you to spin up a fully seeded PostgreSQL database for the Shop application in a repeatable, competition-ready way.
This project requires the following dependencies:
- Programming Language: JavaScript
- Package Manager: Npm
Build Shop from the source and intsall dependencies:
-
Clone the repository:
❯ git clone https://github.com/mjay-kerberos/Shop
-
Navigate to the project directory:
❯ cd Shop -
Install the dependencies:
Using npm:
❯ npm installRun the project with:
Using npm:
npm startShop uses the {test_framework} test framework. Run the test suite with:
Using npm:
npm testThis project is licensed under the MIT License.