Skip to content

Commit 79dec54

Browse files
author
CarlosAndreo
committed
add: first commit
1 parent 2e0268a commit 79dec54

31 files changed

Lines changed: 1759 additions & 1 deletion

.dockerignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.git/
2+
.github/
3+
.venv/
4+
.vscode/
5+
docker/
6+
.dockerignore
7+
.env
8+
.env.dev
9+
.env.template
10+
**/__pycache__/
11+
**/*.py[cod]
12+
.gitignore
13+
CHANGELOG.md
14+
docker-compose.yaml
15+
LICENSE
16+
README.md
17+
ruff.toml
18+
uv.lock

.env.template

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# ─────────────────────────────
2+
# FastAPI CONFIGURATION
3+
# ─────────────────────────────
4+
SECRET_KEY="your-secret-key"
5+
JWT_ALGORITHM="HS256"
6+
ACCESS_TOKEN_EXPIRE_MINUTES=10080 # 60 * 24 * 7 = 10080 minutes = 7 days
7+
8+
# ─────────────────────────────
9+
# MONGODB CONFIGURATION
10+
# ─────────────────────────────
11+
12+
# Root username
13+
MONGO_INITDB_ROOT_USERNAME="admin-user"
14+
# Root password
15+
MONGO_INITDB_ROOT_PASSWORD="admin-password"
16+
# Database name
17+
MONGO_INITDB_DATABASE="test-database"
18+
19+
# ─────────────────────────────
20+
# MONGO-EXPRESS CONFIGURATION
21+
# ─────────────────────────────
22+
23+
# Web password
24+
ME_CONFIG_BASICAUTH_PASSWORD="test"
25+
# Web username
26+
ME_CONFIG_BASICAUTH_USERNAME="test"
27+
ME_CONFIG_MONGODB_ENABLE_ADMIN="false"
28+
ME_CONFIG_MONGODB_PORT=27017
29+
ME_CONFIG_MONGODB_SERVER="${MONGO_INITDB_DATABASE}"
30+
ME_CONFIG_OPTIONS_EDITORTHEME="dracula"
31+
ME_CONFIG_MONGODB_AUTH_DATABASE="${MONGO_INITDB_DATABASE}"
32+
ME_CONFIG_MONGODB_AUTH_USERNAME="${MONGO_INITDB_ROOT_USERNAME}"
33+
ME_CONFIG_MONGODB_AUTH_PASSWORD="${MONGO_INITDB_ROOT_PASSWORD}"
34+
ME_CONFIG_SITE_SESSIONSECRET="secret"
35+
ME_CONFIG_MONGODB_URL="mongodb://${ME_CONFIG_MONGODB_AUTH_USERNAME}:${ME_CONFIG_MONGODB_AUTH_PASSWORD}@${MONGO_INITDB_DATABASE}:${ME_CONFIG_MONGODB_PORT}/${MONGO_INITDB_DATABASE}"

.github/CODEOWNERS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# This is a comment.
2+
# Each line is a file pattern followed by one or more owners.
3+
4+
# These owners will be the default owners for everything in the repo. Unless a later match takes precedence, @CarlosAndreo will be requested for review when someone opens a pull request.
5+
* @CarlosAndreo

.github/workflows/linter.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Lint code with ruff
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "**/*.py"
9+
pull_request:
10+
branches:
11+
- main
12+
paths:
13+
- "**/*.py"
14+
15+
jobs:
16+
lint:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Analysing the code with ruff
23+
uses: astral-sh/ruff-action@v3
24+
with:
25+
args: "check"

.gitignore

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# UV
98+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99+
# This is especially recommended for binary packages to ensure reproducibility, and is more
100+
# commonly ignored for libraries.
101+
#uv.lock
102+
103+
# poetry
104+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105+
# This is especially recommended for binary packages to ensure reproducibility, and is more
106+
# commonly ignored for libraries.
107+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108+
#poetry.lock
109+
110+
# pdm
111+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112+
#pdm.lock
113+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114+
# in version control.
115+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
116+
.pdm.toml
117+
.pdm-python
118+
.pdm-build/
119+
120+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
121+
__pypackages__/
122+
123+
# Celery stuff
124+
celerybeat-schedule
125+
celerybeat.pid
126+
127+
# SageMath parsed files
128+
*.sage.py
129+
130+
# Environments
131+
.env
132+
.venv
133+
env/
134+
venv/
135+
ENV/
136+
env.bak/
137+
venv.bak/
138+
139+
# Spyder project settings
140+
.spyderproject
141+
.spyproject
142+
143+
# Rope project settings
144+
.ropeproject
145+
146+
# mkdocs documentation
147+
/site
148+
149+
# mypy
150+
.mypy_cache/
151+
.dmypy.json
152+
dmypy.json
153+
154+
# Pyre type checker
155+
.pyre/
156+
157+
# pytype static type analyzer
158+
.pytype/
159+
160+
# Cython debug symbols
161+
cython_debug/
162+
163+
# PyCharm
164+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
165+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
166+
# and can be added to the global gitignore or merged into this file. For a more nuclear
167+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
168+
#.idea/
169+
170+
# Ruff stuff:
171+
.ruff_cache/
172+
173+
# PyPI configuration file
174+
.pypirc

.vscode/extensions.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"recommendations": [
3+
"ms-python.python",
4+
"charliermarsh.ruff",
5+
]
6+
}

.vscode/settings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"[python]": {
3+
"editor.formatOnSave": true,
4+
"editor.defaultFormatter": "charliermarsh.ruff"
5+
},
6+
"ruff.configurationPreference": "filesystemFirst",
7+
"ruff.configuration": "${workspaceFolder}/backend/ruff.toml",
8+
}

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Changelog
2+
3+
## [unreleased] - XXXX-XX-XX
4+
5+
### Added
6+
7+
- First implementation fastapi mongodb.
8+
9+
[unreleased]: https://github.com/CarlosAndreo/fastapi-mongodb/releases/tag/unreleased

README.md

Lines changed: 91 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,91 @@
1-
# fastapi-mongodb
1+
<div align="center">
2+
3+
# FastAPI MongoDB <!-- omit in toc -->
4+
5+
[![Contributors][contributors-shield]][contributors-url]
6+
[![Forks][forks-shield]][forks-url]
7+
[![Stargazers][stars-shield]][stars-url]
8+
[![Issues][issues-shield]][issues-url]
9+
[![License][license-shield]][license-url]
10+
11+
[![fastapi-mongodb][fastapi-mongodb-badge]][fastapi-mongodb-url]
12+
13+
[Wiki](https://github.com/CarlosAndreo/fastapi-mongodb/wiki)
14+
15+
</div>
16+
17+
## :brain: About
18+
19+
This is a ready-to-use project template for building FastAPI applications with MongoDB as the database. It's designed to help you get started quickly with a clean architecture, pre-configured settings, and best practices for scalability and maintainability.
20+
21+
## Features
22+
23+
- JWT-based authentication.
24+
25+
## Roadmap
26+
27+
- Email verification.
28+
- Handler exceptions.
29+
30+
## :hammer_and_wrench: Stack
31+
- [![Python][python-badge]][python-url] - Programming language.
32+
- [![FastAPI][fastapi-badge]][fastapi-url] - Python framework for web applications to expose the API.
33+
- [![MongoDB][mongodb-badge]][mongodb-url] - NoSQL database designed to store trial networks.
34+
35+
## :rocket: Getting Started Locally
36+
37+
Install Docker following the instructions for your operating system:
38+
39+
- [Windows](https://docs.docker.com/desktop/setup/install/windows-install/)
40+
41+
- [Ubuntu](https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository)
42+
43+
- [MacOS](https://docs.docker.com/desktop/install/mac-install/)
44+
45+
Clone the repository:
46+
47+
```bash
48+
git clone https://github.com/CarlosAndreo/fastapi-mongodb.git
49+
cd fastapi-mongodb
50+
```
51+
52+
Build the Docker image:
53+
54+
```bash
55+
docker compose build
56+
```
57+
58+
Run the Docker container:
59+
60+
```bash
61+
docker compose up -d
62+
```
63+
64+
The application will be available at `http://localhost:8000`.
65+
66+
The mongo-express UI will be available at `http://localhost:8081`.
67+
68+
## Contributors <!-- omit in toc -->
69+
70+
<a href="https://github.com/CarlosAndreo/fastapi-mongodb/graphs/contributors">
71+
<img src="https://contrib.rocks/image?repo=CarlosAndreo/fastapi-mongodb" />
72+
</a>
73+
74+
[fastapi-mongodb-badge]: https://img.shields.io/github/v/release/CarlosAndreo/fastapi-mongodb?label=fastapi-mongodb&color=blue
75+
[fastapi-mongodb-url]: https://github.com/CarlosAndreo/fastapi-mongodb/releases/latest
76+
[contributors-shield]: https://img.shields.io/github/contributors/CarlosAndreo/fastapi-mongodb.svg?style=for-the-badge
77+
[contributors-url]: https://github.com/CarlosAndreo/fastapi-mongodb/graphs/contributors
78+
[forks-shield]: https://img.shields.io/github/forks/CarlosAndreo/fastapi-mongodb.svg?style=for-the-badge
79+
[forks-url]: https://github.com/CarlosAndreo/fastapi-mongodb/network/members
80+
[stars-shield]: https://img.shields.io/github/stars/CarlosAndreo/fastapi-mongodb.svg?style=for-the-badge
81+
[stars-url]: https://github.com/CarlosAndreo/fastapi-mongodb/stargazers
82+
[issues-shield]: https://img.shields.io/github/issues/CarlosAndreo/fastapi-mongodb.svg?style=for-the-badge
83+
[issues-url]: https://github.com/CarlosAndreo/fastapi-mongodb/issues
84+
[license-shield]: https://img.shields.io/github/license/CarlosAndreo/fastapi-mongodb.svg?style=for-the-badge
85+
[license-url]: https://github.com/CarlosAndreo/fastapi-mongodb/blob/main/LICENSE
86+
[python-badge]: https://img.shields.io/badge/Python-3.13.3-blue?style=for-the-badge&logo=python&logoColor=white&labelColor=3776AB
87+
[python-url]: https://www.python.org/downloads/release/python-3133/
88+
[fastapi-badge]: https://img.shields.io/badge/FastAPI-0.115.12-blue?style=for-the-badge&logo=fastapi&logoColor=white&labelColor=009688
89+
[fastapi-url]: https://fastapi.tiangolo.com/
90+
[mongodb-badge]: https://img.shields.io/badge/MongoDB-8.0-green?style=for-the-badge&logo=mongodb&logoColor=white&labelColor=47A248
91+
[mongodb-url]: https://www.mongodb.com/

app/core/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)