Skip to content

Commit 6c04fe2

Browse files
committed
refactored all usage of postgresql to mongodb
1 parent df13721 commit 6c04fe2

File tree

19 files changed

+92
-304
lines changed

19 files changed

+92
-304
lines changed

CONTRIBUTING.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ After you clone the project, there are several scripts that can help during deve
88

99
Generate a new default project `dev-fsfp`.
1010

11-
Call it from one level above the project directory. So, if the project is at `~/code/full-stack-fastapi-postgresql/`, call it from `~/code/`, like:
11+
Call it from one level above the project directory. So, if the project is at `~/code/full-stack-fastapi-mongodb/`, call it from `~/code/`, like:
1212

1313
```console
1414
$ cd ~/code/
1515

16-
$ bash ./full-stack-fastapi-postgresql/scripts/dev-fsfp.sh
16+
$ bash ./full-stack-fastapi-mongodb/scripts/dev-fsfp.sh
1717
```
1818

1919
It will generate a new project with all the defaults at `~/code/dev-fsfp/`.
@@ -34,12 +34,12 @@ Move the changes from a project `dev-fsfp` back to the project generator.
3434

3535
You would call it after calling `./scripts/dev-fsfp.sh` and adding some modifications to `dev-fsfp`.
3636

37-
Call it from one level above the project directory. So, if the project is at `~/code/full-stack-fastapi-postgresql/`, call it from `~/code/`, like:
37+
Call it from one level above the project directory. So, if the project is at `~/code/full-stack-fastapi-mongodb/`, call it from `~/code/`, like:
3838

3939
```console
4040
$ cd ~/code/
4141

42-
$ bash ./full-stack-fastapi-postgresql/scripts/dev-fsfp-back.sh
42+
$ bash ./full-stack-fastapi-mongodb/scripts/dev-fsfp-back.sh
4343
```
4444

4545
That will also contain all the generated files with the generated variables, but it will let you compare the changes in `dev-fsfp` and the source in the project generator with git, and see what to commit.
@@ -51,7 +51,7 @@ After using `./scripts/dev-fsfp-back.sh`, there will be a bunch of generated fil
5151
To discard all those changes at once, run `discard-dev-files.sh` from the root of the project, e.g.:
5252

5353
```console
54-
$ cd ~/code/full-stack-fastapi-postgresql/
54+
$ cd ~/code/full-stack-fastapi-mongodb/
5555

5656
$ bash ./scripts/dev-fsfp-back.sh
5757
```
@@ -63,7 +63,7 @@ Run the tests. It creates a project `testing-project` *inside* of the project ge
6363
Call it from the root of the project, e.g.:
6464

6565
```console
66-
$ cd ~/code/full-stack-fastapi-postgresql/
66+
$ cd ~/code/full-stack-fastapi-mongodb/
6767

6868
$ bash ./scripts/test.sh
6969
```

README.md

Lines changed: 21 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
# Full Stack FastAPI, PostgreSQL, Neo4j & Nuxt 3 Base Project Generator
1+
# Full Stack FastAPI, React, MongoDB (FARM) Base Project Generator
22

3-
[![Build Status](https://app.travis-ci.com/whythawk/full-stack-fastapi-postgresql.svg?branch=master)](https://app.travis-ci.com/whythawk/full-stack-fastapi-postgresql)
4-
5-
Accelerate your next web development project with this FastAPI/Nuxt.js base project generator.
3+
Accelerate your next web development project with this FastAPI/React/MongoDB base project generator.
64

75
This project is for developers looking to build and maintain full-feature progressive web applications using Python on the backend / Typescript on the frontend, and want the complex-but-routine aspects of auth 'n auth, and component and deployment configuration, taken care of, including interactive API documentation.
86

9-
This is a comprehensively updated fork of [Sebastián Ramírez's](https://github.com/tiangolo) [Full Stack FastAPI and PostgreSQL Base Project Generator](https://github.com/tiangolo/full-stack-fastapi-postgresql). FastAPI is updated to version 0.99 (July 2023), SQLAlchemy to version 2.0 (July 2023), and the frontend to Nuxt 3.6 (July 2023).
7+
This is an **experimental** fork of [Sebastián Ramírez's](https://github.com/tiangolo) [Full Stack FastAPI and PostgreSQL Base Project Generator](https://github.com/tiangolo/full-stack-fastapi-postgresql) and [Whythawk's](https://github.com/whythawk) [Full Stack FastAPI and PostgreSQL Base Project Generator](https://github.com/whythawk/full-stack-fastapi-postgresql). FastAPI is updated to version 0.103.2, MongoDB Motor 3.4, Beanie ODM 1.23, and the frontend to React.
8+
109

1110
- [Screenshots](#screenshots)
1211
- [Key features](#key-features)
@@ -45,30 +44,23 @@ This is a comprehensively updated fork of [Sebastián Ramírez's](https://github
4544

4645
## Key features
4746

48-
This FastAPI, PostgreSQL, Neo4j & Nuxt 3 repo will generate a complete web application stack as a foundation for your project development.
47+
This FastAPI, React, MongoDB repo will generate a complete web application stack as a foundation for your project development.
4948

5049
- **Docker Compose** integration and optimization for local development.
5150
- **Authentication** user management schemas, models, crud and apis already built, with OAuth2 JWT token support & default hashing. Offers _magic link_ authentication, with password fallback, with cookie management, including `access` and `refresh` tokens.
5251
- [**FastAPI**](https://github.com/tiangolo/fastapi) backend with [Inboard](https://inboard.bws.bio/) one-repo Docker images:
53-
- **SQLAlchemy** version 2.0 support for models.
54-
- **MJML** templates for common email transactions.
55-
- **Metadata Schema** based on [Dublin Core](https://www.dublincore.org/specifications/dublin-core/dcmi-terms/#section-3) for inheritance.
52+
- **MongoDB Motor** https://motor.readthedocs.io/en/stable/
53+
- **MongoDB Beanie** for handling ODM creation https://beanie-odm.dev/
5654
- **Common CRUD** support via generic inheritance.
5755
- **Standards-based**: Based on (and fully compatible with) the open standards for APIs: [OpenAPI](https://github.com/OAI/OpenAPI-Specification) and [JSON Schema](http://json-schema.org/).
5856
- [**Many other features**]("https://fastapi.tiangolo.com/features/"): including automatic validation, serialization, interactive documentation, etc.
59-
- [**Nuxt/Vue 3**](https://nuxt.com/) frontend:
57+
- [**Nextjs/React**](https://nextjs.org/) frontend:
6058
- **Authorisation** via middleware for page access, including logged in or superuser.
61-
- **Model blog** project, with [Nuxt Content](https://content.nuxtjs.org/) for writing Markdown pages.
6259
- **Form validation** with [Vee-Validate 4](https://vee-validate.logaretm.com/v4/).
63-
- **State management** with [Pinia](https://pinia.vuejs.org/), and persistance with [Pinia PersistedState](https://prazdevs.github.io/pinia-plugin-persistedstate/).
60+
- **State management** with [Redux](https://redux.js.org/)
6461
- **CSS and templates** with [TailwindCSS](https://tailwindcss.com/), [HeroIcons](https://heroicons.com/), and [HeadlessUI](https://headlessui.com/).
65-
- **Internationalisation** with [@nuxt/i18n](https://nuxt.com/modules/i18n).
66-
- **PWA support** with [Vite PWA plugin](https://vite-pwa-org.netlify.app/frameworks/nuxt.html).
67-
- **PostgreSQL** database.
68-
- **PGAdmin** for PostgreSQL database management.
6962
- **Celery** worker that can import and use models and code from the rest of the backend selectively.
7063
- **Flower** for Celery jobs monitoring.
71-
- **Neo4j** graph database, including integration into the FastAPI base project.
7264
- Load balancing between frontend and backend with **Traefik**, so you can have both under the same domain, separated by path, but served by different containers.
7365
- Traefik integration, including Let's Encrypt **HTTPS** certificates automatic generation.
7466
- GitLab **CI** (continuous integration), including frontend and backend testing.
@@ -85,14 +77,14 @@ This FastAPI, PostgreSQL, Neo4j & Nuxt 3 repo will generate a complete web appli
8577

8678
After using this generator, your new project (the directory created) will contain an extensive `README.md` with instructions for development, deployment, etc. You can pre-read [the project `README.md` template here too](./{{cookiecutter.project_slug}}/README.md).
8779

88-
This current release (August 2023) is for FastAPI version 0.99 and is the last before introducing support for Pydantic 2. Since this is intended as a base stack on which you will build complex applications, there is no intention of backwards compatability between releases, and the objective is to ensure that each release has the latest long-term-support versions of the core libraries so that you can rely on your application core for as long as possible.
80+
This current release (October 2023) is for FastAPI version 0.103 and introduces support for Pydantic 2. Since this is intended as a base stack on which you will build complex applications, there is no intention of backwards compatability between releases, and the objective is to ensure that each release has the latest long-term-support versions of the core libraries so that you can rely on your application core for as long as possible.
8981

9082
To align with [Inboard](https://inboard.bws.bio/), Poetry has been deprecated in favour of [Hatch](https://hatch.pypa.io/latest/). This will also, hopefully, sort out some Poetry-related Docker build errors.
9183

92-
You will also find an initial implementation of internationalisation using [@nuxt/i18n](https://nuxt.com/modules/i18n). This is - at this time - a release candidate, so please do update and check their documentation for any changes. The [Vite PWA plugin](https://vite-pwa-org.netlify.app/frameworks/nuxt.html) is also included, along with a Node CLI for generating all necessary app icons. You will see links and notes to this in the [nuxt.config.ts](./{{cookiecutter.project_slug}}/frontend/nuxt.config.ts) file.
93-
9484
## Help needed
9585

86+
This stack is in an experimental state, so there is no guarantee for bugs or issues. Please open an issue ticket against this repository to make us aware of issues and we will do our best to respond to them in a timely manner. Please leave feedback on features that would be very beneficial for developers who often leverage mongodb in their FastAPI stack.
87+
9688
The tests are broken and it would be great if someone could take that on. Other potential roadmap items:
9789

9890
- Translation: docs are all in English and it would be great if those could be in other languages.
@@ -101,43 +93,18 @@ The tests are broken and it would be great if someone could take that on. Other
10193

10294
## Release Notes
10395

104-
See notes and [releases](https://github.com/whythawk/full-stack-fastapi-postgresql/releases).
105-
106-
## 0.8.2
107-
108-
Fixing [#39](https://github.com/whythawk/full-stack-fastapi-postgresql/issues/39), thanks to @a-vorobyoff:
109-
110-
- Exposing port 24678 for Vite on frontend in development mode.
111-
- Ensuring Nuxt content on /api/_content doesn't interfere with backend /api/v routes.
112-
- Checking for password before hashing on user creation.
113-
- Updating generated README for Hatch (after Poetry deprecation).
114-
- Minor fixes.
115-
116-
### 0.8.1
117-
118-
- Minor updates to Docker scripts for `build`.
119-
120-
### 0.8.0
96+
See notes:
12197

122-
- Updates to `frontend`, [#37](https://github.com/whythawk/full-stack-fastapi-postgresql/pull/37) by @turukawa:
123-
- `@nuxtjs/i18n` for internationalisation, along with language selection component.
124-
- `@vite-pwa/nuxt` along with button components for install and refreshing the app and service workers, and a CLI icon generator.
125-
- `@nuxtjs/robots` for simple control of `robots.txt` permissions from `nuxt.config.ts`.
98+
## 0.1.0
12699

127-
### 0.7.4
128-
- Updates: Complete update of stack to latest long-term releases. [#35](https://github.com/whythawk/full-stack-fastapi-postgresql/pull/35) by @turukawa, review by @br3ndonland
129-
- `frontend`:
130-
- Node 16 -> 18
131-
- Nuxt 3.2 -> 3.6.5
132-
- Latest Pinia requires changes in stores, where imports are not required (cause actual errors), and parameter declaration must happen in functions.
133-
- `backend` and `celeryworker`:
134-
- Python 3.9 -> 3.11
135-
- FastAPI 0.88 -> 0.99 (Inboard 0.37 -> 0.51)
136-
- Poetry -> Hatch
137-
- Postgres 14 -> 15
138-
- Fixed: Updated token url in deps.py [#29](https://github.com/whythawk/full-stack-fastapi-postgresql/pull/29) by @vusa
139-
- Docs: Reorganised documentation [#21](https://github.com/whythawk/full-stack-fastapi-postgresql/pull/21) by @turukawa
100+
- Replaced Next/Vue.js frontend framework with entirely React/Redux
101+
- Replaced Backend native connection of PostgreSQL/SQLAlchemy with MongoDB Motor/Beanie ODM
102+
- Removed Neo4j plugin
103+
- Removed Alembic Usage
104+
- Introduced new cookiecutter environment variables `mongo_host`, `mongo_user`, `mongo_password`, and `mongo_database`
105+
- Introduced support for Pydantic 2
140106

107+
[Historic changes from whythawk](https://github.com/whythawk/full-stack-fastapi-postgresql/releases)
141108
[Historic changes from original](https://github.com/tiangolo/full-stack-fastapi-postgresql#release-notes)
142109

143110
## License

cookiecutter.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
"mongodb_password": "changethis",
2929
"mongodb_database": "changethis",
3030

31-
"neo4j_password": "changethis",
32-
3331
"traefik_constraint_tag": "{{cookiecutter.domain_main}}",
3432
"traefik_constraint_tag_staging": "{{cookiecutter.domain_staging}}",
3533
"traefik_public_constraint_tag": "traefik-public",

docs/deployment-guide.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ These files will also need to be customised for production deployment. Make alte
4242

4343
This guide uses [DigitalOcean Droplets](https://www.digitalocean.com/pricing/droplets), so customise as required. Deploy to the smallest (currently 500MiB memory, 1 vCPU and 10GiB SSD for $4/month). You can upgrade later when you know your resource requirements.
4444

45-
> **WARNING**: if you're using `neo4j` then the `java` server alone will need 1Gb of memory, and you may need a 2Gb to 4Gb base droplet. Plan accordingly. If you decide not to use it, you will need to carefully remove it. That will require editing `docker-compose.yml` and the start-up sequence in the backend. Shouldn't be too challenging.
46-
4745
Ensure you add your SSH encryption keys on launch so that your server can be secure from the beginning.
4846

4947
Deploy on whatever server image your prefer, although the default would be Ubuntu 20.04 (22.04 is the latest). End-of-life for 20.04 is April 2030, and for 22.04 is April 2032. You have time. The underlying image isn't that critical, as you'll be using the Docker images at their current versions.
@@ -56,7 +54,7 @@ For reference:
5654
- [Link Namecheap domain to DigitalOcean](https://www.namecheap.com/support/knowledgebase/article.aspx/10375/2208/how-do-i-link-a-domain-to-my-digitalocean-account/)
5755
- [Manage DNS records at DigitalOcean](https://docs.digitalocean.com/products/networking/dns/how-to/manage-records/)
5856

59-
Don't forget to create DNS A records for `flower`, `neo4j`, `traefik`, and `pgadmin`.
57+
Don't forget to create DNS A records for `flower`, `traefik`.
6058

6159
Now you should be able to login to your server and begin deployment.
6260

@@ -318,7 +316,5 @@ These are the URLs served in production (replace `example.com` with your own):
318316
- Backend: https://example.com/api/
319317
- Automatic Interactive Docs (Swagger UI): https://example.com/docs
320318
- Automatic Alternative Docs (ReDoc): https://example.com/redoc
321-
- PGAdmin: https://pgadmin.example.com
322319
- Flower: https://flower.example.com
323-
- Traefik: https://traefik.example.com
324-
- Neo4j: https://neo4j.example.com
320+
- Traefik: https://traefik.example.com

docs/development-guide.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ The input variables, with their default values (some auto generated) are:
6161
- `smtp_emails_from_email`: The email account to use as the sender in the notification emails, it could be something like `[email protected]`.
6262
- `smtp_emails_from_name`: The email account name to use as the sender in the notification emails, it could be something like `Symona Adaro`.
6363
- `smtp_emails_to_email`: The email account to use as the recipient for `contact us` emails, it could be something like `[email protected]`.
64-
- `postgres_password`: Postgres database password. Use the method above to generate it. (You could easily modify it to use MySQL, MariaDB, etc).
65-
- `pgadmin_default_user`: PGAdmin default user, to log-in to the PGAdmin interface.
66-
- `pgadmin_default_user_password`: PGAdmin default user password. Generate it with the method above.
67-
- `neo4j_password`: Neo4j database password. Use the method above to generate it.
64+
- `mongo_host`: MongoDB host cluster URI password
65+
- `mongo_user`: MongoDB User account to access the cluster
66+
- `mongodb_password`: MongoDB password for access to the cluster
67+
- `mongodb_database`: MongoDB database to have the application operate within
6868
- `traefik_constraint_tag`: The tag to be used by the internal Traefik load balancer (for example, to divide requests between backend and frontend) for production. Used to separate this stack from any other stack you might have. This should identify each stack in each environment (production, staging, etc).
6969
- `traefik_constraint_tag_staging`: The Traefik tag to be used while on staging.
7070
- `traefik_public_constraint_tag`: The tag that should be used by stack services that should communicate with the public.

0 commit comments

Comments
 (0)