This project implements a Card creator web app were you can create your own card game easily with only a csv.
The project is organized into several folders with a modular structure to make it easy to extend and maintain:
CardCreator/
│
├── backend/
│ └── app/
│ ├── api/ # API
│ │ └── v1/
│ │ ├── endpoints/ # Endpoints
│ │ │ ├── auth.py
│ │ │ ├── cards.py
│ │ │ └── users.py
│ │ │
│ │ └── api_v1.py # Routes
│ │
│ ├── core/
│ │ ├── config.py
│ │ └── security.py
│ │
│ ├── database/ # Database
│ │ ├── base.py
│ │ └── session.py
│ │
│ ├── models/
│ │ └── user.py
│ │
│ ├── schemas/
│ │ └── user.py
│ │
│ ├── services/ # Backend services
│ │ ├── card_service.py
│ │ └── user_service.py
│ │
│ ├── utils/
│ │ └── auth.py
│ │
│ └── main.py # The backend main script
│
├──frontend/
│ └── src/
│ ├── components/ # Frontend custom components
│ │ ├── button/
│ │ │ └── Button.js
│ │ │
│ │ ├── cardManager/
│ │ │ └── CardManager.js
│ │ │
│ │ ├── cardPreview/
│ │ │ └── CardPreview.js
│ │ │
│ │ ├── colorPicker/
│ │ │ └── ColorPicker.js
│ │ │
│ │ ├── fileInput/
│ │ │ └── FileInput.js
│ │ │
│ │ ├── fontSelector/
│ │ │ └──FontSelector.js
│ │ │
│ │ ├── header/
│ │ │ └── Header.js
│ │ │
│ │ ├── text/
│ │ │ └── Text.js
│ │ │
│ │ └── textInput/
│ │ └── TextInput.js
│ │
│ ├── pages/ # Frontend pages
│ │ ├── CreatorPage.js
│ │ ├── HomePage.js
│ │ ├── MyCardsPage.js
│ │ └── PdfPreviewPage.js
│ │
│ ├── services/ # Frontend api service
│ │ └── apiService.js
│ │
│ ├── App.js # Frontend app script
│ ├── index.js
│ └── default.svg # Default card background
│
├── script/
│ ├── data/ # Folder for CSV files
│ │ └── cards.csv # CSV with the information of the cards
│ │
│ ├── images/ # Type of cards of the game
│ │ ├── card_type_1.png
│ │ └── card_type_2.png
│ │
│ └── main.py # The main script
│
├── README.md
└── requirements.txt # Dependencies of the project
To set up the environment and dependencies for the project, follow these steps:
First, clone this repository to your local machine:
git clone https://github.com/chave-chan/CardCreator.git
cd CardCreatorTo manage dependencies, we will create a virtual environment using Python’s built-in tool venv.
Run the following command in the root of your project directory to create a new virtual environment called env:
python3 -m venv envThis will create a new folder env/ in your project directory where the virtual environment will be stored.
-
On Windows:
env\Scripts\activate
-
On macOS/Linux:
source env/bin/activate
When the virtual environment is activated, you’ll see (env) at the beginning of your terminal prompt.
With the virtual environment activated, install the project dependencies from the requirements.txt file:
pip install -r requirements.txtIf the system asks for it, upgrade pip:
pip install --upgrade pipdocker-compose build --no-cachedocker-compose up -dGo to the frontend directory
npm startIf a 'file is missing' message appears, try:
npm install
npm startGo to the backend directory
uvicorn app.main:app --host 0.0.0.0 --port 8000When you are done working on the project, you can deactivate the virtual environment by running:
deactivateThis will return your terminal to its default Python environment.