An open API service indexing awesome lists of open source software.

https://github.com/chasenio/full-stack-fastapi-nextjs

Full Stack With FastAPI & Next.js
https://github.com/chasenio/full-stack-fastapi-nextjs

fastapi flyio full-stack fullstack indiehacker nextjs wrangler

Last synced: 6 months ago
JSON representation

Full Stack With FastAPI & Next.js

Awesome Lists containing this project

README

          

- [Full Stack With FastAPI \& Next.js](#full-stack-with-fastapi--nextjs)
- [Dependencies](#dependencies)
- [Services ops](#services-ops)
- [Deploy](#deploy)
- [Support](#support)

## Full Stack With FastAPI & Next.js

This is a full stack template using FastAPI and Next.js.

- deploy api with [fly.io][1]
- app config with consul (via fly.io)
- deploy frontend with [cloudflare pages][2]

## Dependencies

Command line tools:
- [flyctl](https://fly.io/docs/flyctl/install/)
- [pnpm](https://pnpm.io/installation)
- [wrangler](https://developers.cloudflare.com/workers/wrangler/install-and-update/)

## Services ops

**api**

create your app with fly.io

```shell
fly apps create --name -o
```

attach consul to api

```shell
fly consul attach -a
```

set config with consul

1. get consul url, `fly ssh console -a `
2. show consul url, `echo $FLY_CONSUL_URL`

example:

`https://:@consul-syd-5.fly-shared.net/-xxxxxxxxxx/`

- `consul-syd-5.fly-shared.net` is consul server, open in browser
- click `Login` and input consul ``
- click `Key/Value` and input `-xxxxxxxxxx/` in `Key or folder` input; example: `appname-xxxxxxxxx/appname`
- copy `config.yml` content to `Value` input, click `Save`
- `main.py` will read consul config; see [config.py][4]

**ui**

create project with cloudflare pages

```shell
cd ui && pnpm wrangler pages project create --production-branch master
```

deploy project with cloudflare pages , See this file [Makefile][3]

```shell
make ui # deploy ui
```

## Deploy

deploy api
```
make api
```

deploy frontend
```
make ui
```

## Support

If you like this project, please consider supporting me for coffee ☕️

[![Buy Me A Coffee](https://img.shields.io/badge/buy%20me%20-coffee-%2322BC18.svg)](https://www.buymeacoffee.com/chasengao) [![get youtself link](https://img.shields.io/badge/get%20youtself%20link-buymeacoffee-orange.svg)](https://www.buymeacoffee.com/invite/chasengao)

[1]: https://fly.io
[2]: https://pages.cloudflare.com
[3]: Makefile
[4]: src/config.py