https://github.com/tyronejosee/project_coding_latam_api
A JSON API created for the Coding Latam community
https://github.com/tyronejosee/project_coding_latam_api
fastapi python railway render starlette uvicorn
Last synced: about 1 month ago
JSON representation
A JSON API created for the Coding Latam community
- Host: GitHub
- URL: https://github.com/tyronejosee/project_coding_latam_api
- Owner: tyronejosee
- License: mit
- Created: 2024-08-22T16:17:45.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-31T17:44:27.000Z (almost 2 years ago)
- Last Synced: 2025-02-28T13:05:33.945Z (over 1 year ago)
- Topics: fastapi, python, railway, render, starlette, uvicorn
- Language: Python
- Homepage: https://coding-latam-api.up.railway.app/docs
- Size: 569 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Coding Latam API
The JSON used as the database is located in [`app/data/db.py`](https://github.com/tyronejosee/project_coding_latam_api/blob/main/app/data/db.py)
## Requirements
- Python 3.8+
## Installation
Clone the repository and navigate to the project directory:
```bash
git clone git@github.com:tyronejosee/project_coding_latam_api.git
```
### Virtual Environment Setup
It is recommended to create a virtual environment to isolate all the project dependencies:
```bash
# Linux
python3 -m venv env
# Windows
python -m venv env
```
Activate the virtual environment:
```bash
# Linux
source venv/bin/activate
# Windows
venv\Scripts\activate
```
### Installing Dependencies
You can install the dependencies using `pip` or `Poetry`.
#### pip
```bash
pip install -r requirements.txt
```
#### Poetry
```bash
poetry install
```
Create a copy of the `.env.example` file and rename it to `.env`.
```bash
cp .env.example .env
```
**Update the values of the environment variables (Important).**
## Running the Application
To run the application in development mode, use:
```bash
uvicorn app.main:app --reload
```
This will start the server at `http://127.0.0.1:8000`.
### API Documentation
Once the application is running, you can access the interactive documentation at:
- Swagger UI: `http://127.0.0.1:8000/docs`
- Redoc: `http://127.0.0.1:8000/redoc`
## Deploy
### Example with Railway
Log in or sign up at [railway.app](https://railway.app/).
Select New on your dashboard and Deploy from GitHub repo:

Configure and grant permission to the specific repositories for deployment:


Go to the Settings tab of the instance.

Add the command `pip install -r requirements.txt` in the `Custom Build Command` field:

Add the command `uvicorn app.main:app --host 0.0.0.0 --port $PORT` in the `Custom Start Command` field:

After completing the Railway process, click on `Generate Domain` within `Settings`:

And your API will be deployed successfully. 🎉🎉
