Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update libraries #200

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
fastapi-react
node_modules/
package-lock.json
package-lock.jsonvenv
venv/
node_modules/
.idea/
22 changes: 19 additions & 3 deletions cookiecutter.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
{
"project_slug": "fastapi-react-project",
"project_name": "{{ cookiecutter.project_slug }}",
"project_name": "{{cookiecutter.project_slug}}",
"project_tld": "com",
"port": "8000",
"postgres_user": "postgres",
"postgres_password": "password",
"postgres_database": "app",
"superuser_email": "admin@{{cookiecutter.project_name}}.com",
"superuser_email": "admin@{{cookiecutter.project_name}}.{{cookiecutter.project_tld}}",
"superuser_password": "password",
"secret_key": "super_secret"
"secret_key": "super_secret",
"_copy_without_render": [
"frontend/node_modules/*",
"frontend/public/*",
"frontend/src/views/*",
"frontend/src/utils/*",
"frontend/src/config/*",
"frontend/src/admin/*",
"frontend/src/__tests__/*",
"frontend/src/App.tsx",
"frontend/src/AppRoutes.tsx",
"frontend/src/decs.d.ts",
"frontend/src/index.css",
"frontend/src/logo.svg",
"frontend/src/react-app-env.d.ts"
]
}
7 changes: 3 additions & 4 deletions {{cookiecutter.project_slug}}/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

## Features

- **FastAPI** with Python 3.8
- **React 16** with Typescript, Redux, and react-router
- **FastAPI** with Python 3.10
- **React 18** with Typescript, Redux, and react-router
- Postgres
- SqlAlchemy with Alembic for migrations
- Pytest for backend tests
Expand Down Expand Up @@ -154,6 +154,5 @@ frontend
│ └── index.tsx # constants
├── __tests__
│ └── test_home.tsx
├── index.tsx # entrypoint
└── App.tsx # handles routing
└── index.tsx # entrypoint
```
1 change: 1 addition & 0 deletions {{cookiecutter.project_slug}}/backend/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.10.8
2 changes: 1 addition & 1 deletion {{cookiecutter.project_slug}}/backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

FROM python:3.8
FROM python:3.10

RUN mkdir /app
WORKDIR /app
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
16 changes: 8 additions & 8 deletions {{cookiecutter.project_slug}}/backend/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
from starlette.requests import Request
import uvicorn

from app.api.api_v1.routers.users import users_router
from app.api.api_v1.routers.auth import auth_router
from app.core import config
from app.db.session import SessionLocal
from app.core.auth import get_current_active_user
from app.core.celery_app import celery_app
from app import tasks
from api.api_v1.routers.users import users_router
from api.api_v1.routers.auth import auth_router
from core import config
from db.session import SessionLocal
from core.auth import get_current_active_user
from core.celery_app import celery_app
from app.tasks import example_task


app = FastAPI(
Expand All @@ -31,7 +31,7 @@ async def root():

@app.get("/api/v1/task")
async def example_task():
celery_app.send_task("app.tasks.example_task", args=["Hello World"])
celery_app.send_task("example_task", args=["Hello World"])

return {"message": "success"}

Expand Down
8 changes: 4 additions & 4 deletions {{cookiecutter.project_slug}}/backend/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
from fastapi.testclient import TestClient
import typing as t

from app.core import config, security
from app.db.session import Base, get_db
from app.db import models
from app.main import app
from .core import config, security
from .db.session import Base, get_db
from .db import models
from .main import app


def get_test_db_url() -> str:
Expand Down
87 changes: 68 additions & 19 deletions {{cookiecutter.project_slug}}/backend/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,68 @@
alembic==1.4.3
Authlib==0.14.3
fastapi==0.65.2
celery==5.0.0
redis==3.5.3
httpx==0.15.5
ipython==7.31.1
itsdangerous==1.1.0
Jinja2==2.11.3
psycopg2==2.8.6
pytest==6.1.0
requests==2.24.0
SQLAlchemy==1.3.19
uvicorn==0.12.1
passlib==1.7.2
bcrypt==3.2.0
sqlalchemy-utils==0.36.8
python-multipart==0.0.5
pyjwt==1.7.1
alembic==1.11.1
amqp==5.1.1
anyio==3.6.2
asttokens==2.2.1
async-timeout==4.0.2
Authlib==1.2.0
backcall==0.2.0
bcrypt==4.0.1
billiard==3.6.4.0
celery==5.2.7
certifi==2023.5.7
cffi==1.15.1
charset-normalizer==3.1.0
click==8.1.3
click-didyoumean==0.3.0
click-plugins==1.1.1
click-repl==0.2.0
cryptography==40.0.2
decorator==5.1.1
exceptiongroup==1.1.1
executing==1.2.0
fastapi==0.95.2
greenlet==2.0.2
h11==0.14.0
httpcore==0.17.2
httpx==0.24.1
idna==3.4
iniconfig==2.0.0
ipython==8.13.2
itsdangerous==2.1.2
jedi==0.18.2
Jinja2==3.1.2
kombu==5.2.4
Mako==1.2.4
MarkupSafe==2.1.2
matplotlib-inline==0.1.6
packaging==23.1
parso==0.8.3
passlib==1.7.4
pexpect==4.8.0
pickleshare==0.7.5
pluggy==1.0.0
prompt-toolkit==3.0.38
psycopg2-binary==2.9.6
ptyprocess==0.7.0
pure-eval==0.2.2
pycparser==2.21
pydantic==1.10.8
Pygments==2.15.1
PyJWT==2.7.0
pytest==7.3.1
python-multipart==0.0.6
pytz==2023.3
redis==4.5.5
requests==2.31.0
six==1.16.0
sniffio==1.3.0
SQLAlchemy==2.0.15
SQLAlchemy-Utils==0.41.1
stack-data==0.6.2
starlette==0.27.0
tomli==2.0.1
traitlets==5.9.0
typing_extensions==4.6.0
urllib3==2.0.2
uvicorn==0.22.0
vine==5.0.0
wcwidth==0.2.6
23 changes: 16 additions & 7 deletions {{cookiecutter.project_slug}}/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3.7'
services:
nginx:
image: nginx:1.17
image: nginx:1.24.0-alpine
volumes:
- ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf
ports:
Expand All @@ -13,10 +13,10 @@ services:
redis:
image: redis
ports:
- 6379:6379
- 8889:8889

postgres:
image: postgres:12
image: postgres:15
restart: always
environment:
POSTGRES_USER: {{cookiecutter.postgres_user}}
Expand All @@ -32,13 +32,22 @@ services:
dockerfile: Dockerfile
command: celery --app app.tasks worker --loglevel=DEBUG -Q main-queue -c 1

flower:
image: mher/flower
command: celery flower --broker=redis://redis:6379/0 --port=5555
ports:
flower:
build:
context: .
dockerfile: ./docker/flower.Dockerfile
image: fastapi-react/flower
command: sh -c "/wait && celery flower --broker=redis://redis:6379/0 --port=5555"
environment:
- CELERY_BROKER_URL=redis://redis:6379/0
- WAIT_HOSTS=postgres:5432, redis:6379
- WAIT_HOSTS_TIMEOUT=60
- WAIT_BEFORE_HOSTS=10
ports:
- 5555:5555
depends_on:
- "redis"
- "postgres"

backend:
build:
Expand Down
5 changes: 5 additions & 0 deletions {{cookiecutter.project_slug}}/docker/flower.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM mher/flower as base
USER root
COPY --from=ghcr.io/ufoscout/docker-compose-wait:latest /wait /wait
RUN chmod +x /wait
USER nobody
9 changes: 5 additions & 4 deletions {{cookiecutter.project_slug}}/frontend/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ let rules = {
};

module.exports = {
extends: ['airbnb', 'plugin:prettier/recommended', 'prettier/react'],
parser: 'babel-eslint',
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended', 'prettier'],
parser: '@typescript-eslint/parser',
// parser: '@babel/eslint-parser',
rules,
env: {
browser: true,
Expand All @@ -31,7 +32,7 @@ module.exports = {
jest: true,
es6: true,
},
plugins: ['react', 'react-hooks', 'jsx-a11y'],
plugins: ['@typescript-eslint', 'react', 'react-hooks', 'jsx-a11y'],
settings: {
ecmascript: 6,
jsx: true,
Expand All @@ -45,7 +46,7 @@ module.exports = {
},
react: {
pragma: 'React',
version: '16.8',
version: '18.2.0',
},
},
};
3 changes: 2 additions & 1 deletion {{cookiecutter.project_slug}}/frontend/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = {
printWidth: 80,
singleQuote: true,
trailingComma: 'es5',
trailingComma: 'none',
jsxSingleQuote: true
};
64 changes: 37 additions & 27 deletions {{cookiecutter.project_slug}}/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,25 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"ra-data-json-server": "^3.5.2",
"ra-data-simple-rest": "^3.3.2",
"react": "^16.13.1",
"react-admin": "^3.5.2",
"react-dom": "^16.13.1",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.3",
"react-truncate": "^2.4.0",
"standard": "^14.3.3",
"@babel/eslint-parser": "^7.21.8",
"@emotion/react": "^11.11.0",
"@emotion/styled": "^11.11.0",
"@material-ui/lab": "^4.0.0-alpha.54",
"@mui/icons-material": "^5.11.16",
"@mui/lab": "^5.0.0-alpha.131",
"@mui/system": "^5.13.2",
"eslint-plugin-prettier": "^4.2.1",
"eslist": "^1.0.0-beta.1",
"jwt-decode": "^3.0.0",
"@material-ui/lab": "^4.0.0-alpha.54"
"ra-data-json-server": "^4.10.5",
"ra-data-simple-rest": "^4.10.5",
"react": "^18.2.0",
"react-admin": "^4.10.5",
"react-dom": "^18.2.0",
"react-router-dom": "^6.11.2",
"react-scripts": "5.0.1",
"react-truncate": "^2.4.0",
"standard": "^17.0.0"
},
"scripts": {
"start": "react-scripts start",
Expand All @@ -37,26 +45,28 @@
]
},
"devDependencies": {
"typescript": "^4.0.2",
"@testing-library/jest-dom": "^5.11.1",
"@testing-library/react": "^11.0.4",
"@typescript-eslint/eslint-plugin": "^2.24.0",
"@typescript-eslint/parser": "^2.24.0",
"@testing-library/user-event": "^12.0.11",
"@types/jest": "^26.0.3",
"@types/node": "^14.0.1",
"@types/react": "^16.9.19",
"@types/react-dom": "^16.9.5",
"@types/react-router-dom": "^5.1.3",
"@types/jwt-decode": "^2.2.1",
"eslint-config-airbnb": "^18.1.0",
"eslint-config-react-app": "^5.2.1",
"eslint-plugin-flowtype": "^4.6.0",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.4.3",
"@types/jest": "^29.5.1",
"@types/jwt-decode": "^3.1.0",
"@types/node": "^20.2.3",
"@types/react": "^18.2.6",
"@types/react-dom": "^18.2.4",
"@types/react-router-dom": "^5.3.3",
"@typescript-eslint/eslint-plugin": "^5.59.7",
"@typescript-eslint/parser": "^5.59.7",
"babel-eslint": "^10.1.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^8.8.0",
"eslint-config-react-app": "^7.0.1",
"eslint-plugin-flowtype": "^8.0.3",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.19.0",
"eslint-plugin-react-hooks": "^2.5.1",
"prettier": "^2.0.5",
"react-test-renderer": "^16.13.1"
"eslint-plugin-react-hooks": "^4.6.0",
"prettier": "^2.8.8",
"react-test-renderer": "^18.2.0",
"typescript": "^5.0.4"
}
}
6 changes: 0 additions & 6 deletions {{cookiecutter.project_slug}}/frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +0,0 @@
import React, { FC } from 'react';
import { Routes } from './Routes';

const App: FC = () => <Routes />;

export default App;
Loading