Skip to content

Commit b7542af

Browse files
committed
📝 docs: enhance README with detailed features and encryption key generation instructions
1 parent 5229c17 commit b7542af

File tree

1 file changed

+65
-18
lines changed

1 file changed

+65
-18
lines changed

README.md

Lines changed: 65 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1-
# :zap: Fastapi api template
1+
# :zap: FastAPI API Template
22

3-
Template API with FastApi
3+
4+
This template provides a robust starting point for building APIs with FastAPI. It includes user authentication, CRUD operations, JWT token-based authentication, and PostgreSQL integration. The setup is streamlined with Docker and includes comprehensive documentation and testing tools.
5+
6+
## :pushpin: Features
7+
8+
- :closed_lock_with_key: User authentication with basic login and Google Auth
9+
- :busts_in_silhouette: User management with creation and CRUD operations
10+
- :page_facing_up: Example endpoints for Posts, Users, and Votes
11+
- :heartbeat: API healthcheck endpoint
12+
- :key: JWT token-based authentication
13+
- :gear: Middleware support
14+
- :earth_americas: CORS configuration
15+
- :memo: Comprehensive Swagger API documentation
16+
- :elephant: PostgreSQL database integration
17+
- :lock: Field encryption for sensitive data
418

519
## :floppy_disk: Installation
620

@@ -69,6 +83,17 @@ https://developers.google.com/workspace/guides/create-credentials
6983
openssl rand -base64 64
7084
```
7185

86+
:closed_lock_with_key: How to create an encryption key:
87+
88+
89+
To create an encryption key for securing sensitive data, you can use the `generate_key.py` script provided in the repository. Run the following command:
90+
91+
```bash
92+
python generate_key.py
93+
```
94+
95+
This will generate a secure encryption key.
96+
7297
:construction: Before first run:
7398

7499
Run `docker-compose` :whale: to start the database server
@@ -95,22 +120,6 @@ openssl req -x509 -newkey rsa:4096 -nodes -out cert.pem -keyout key.pem -days 36
95120
uvicorn app.main:app --reload --port 8000 --ssl-keyfile key.pem --ssl-certfile cert.pem
96121
```
97122

98-
## :pushpin: Features
99-
100-
- Basic login
101-
- Google Auth login
102-
- Create users
103-
- Examples endpoints CRUD
104-
- Posts
105-
- Users
106-
- Votes
107-
- API healthcheck
108-
- JWT tokens
109-
- Middlewares
110-
- CORS
111-
- Complete swagger Api info
112-
- Postgres
113-
114123
## :rotating_light: Lint
115124

116125
Run linter and formatter
@@ -158,3 +167,41 @@ or
158167
```bash
159168
scripts/test.sh
160169
```
170+
171+
## :hammer_and_wrench: Alembic
172+
173+
Alembic is used for database migrations. Below are some common commands to manage your database schema.
174+
175+
### Autogenerate a revision
176+
177+
To autogenerate a new revision based on the changes detected in your models, run:
178+
179+
```bash
180+
alembic revision --autogenerate -m "your message here"
181+
```
182+
183+
### Generate a blank revision
184+
185+
To create a blank revision for custom migrations, run:
186+
187+
```bash
188+
alembic revision -m "your message here"
189+
```
190+
191+
### Upgrade the database
192+
193+
To apply the latest migrations and upgrade the database schema, run:
194+
195+
```bash
196+
alembic upgrade head
197+
```
198+
199+
### Downgrade the database
200+
201+
To revert the last migration and downgrade the database schema, run:
202+
203+
```bash
204+
alembic downgrade -1
205+
```
206+
207+
After creating a revision, you can edit the generated script to define your custom migrations.

0 commit comments

Comments
 (0)