- About
- Requirements to run the project
- How to run the project
- How to deploy
- Compatibility
- Contributing
- Author
- License
A head start template for fullstack projects with integrated Vue front-end (bun/NodeJS) and FastAPI back-end (Python).
make
4.3;sudo apt install build-essential
on Ubuntu (build-essential might be needed forpyenv
); orsudo apt install make
on Ubuntu; orbrew install make
on macOS; orchoco install make
on Windows;
- Python 3.9.18;
- Current Vercel supported version (but, if you're using more recent versions, it should probably work locally);
- I personally recommend using pyenv for Python version management;
- Node.js v20.11.0;
- I personally recommend using nvm for Node.js version management;
- Bun 1.0.26: install here;
- Clone the repository with:
git clone [email protected]:ArielMAJ/fullstack-vue-fastapi-template.git
(needs SSH key setup); orgit clone https://github.com/ArielMAJ/fullstack-vue-fastapi-template.git
(no need for SSH key setup);- Download it if you don't have git and doesn't want to install it;
- Change directory:
cd fullstack-vue-fastapi-template
; - Create
.env
's from the.env.example
files (you can just copy them as they are):make default-dot-envs
- Install the dependencies:
make install
- Run the backend in a terminal:
make run-api
- Run the frontend in another terminal:
make run-vue
- Access the frontend at
http://localhost:8080/
. - Access the backend docs at
http://localhost:3000/docs
orhttp://localhost:3000/redoc
.
There are many possible ways to deploy the frontend. If you're using just the front-end part of the template, I recommend bringing the front-end to the root of the repository, and using Vercel to deploy it. You can also use GitHub Pages to deploy it and this is my personal recommendation if you're using both front and back end in the same repository.
To deploy with GitHub pages:
- Access the equivalent of
https://github.com/ArielMAJ/fullstack-vue-fastapi-template/settings/pages
for your repository; - Select "deploy from a branch" and select
gh-pages
(create the branch if it doesn't exist);
GitHub Pages will automatically deploy the frontend from the gh-pages
branch of the repository every time something is pushed there. You can do this manually by running bun run build
and pushing the dist
folder to the gh-pages
branch of the repository (this might be a little confusing to do). My recommendation is to make use of GitHub Actions to automate the process. The auto_deploy.yml file is already set up for this:
Everytime you push to the main
branch, the action will run and deploy the frontend to the gh-pages
branch. You can check the status of the action in the "Actions" tab of the repository. If you want to use this action, you will need to set up the repository secrets and variables:
- Repository secret
ACCESS_TOKEN
(access the equivalent ofhttps://github.com/ArielMAJ/fullstack-vue-fastapi-template/settings/secrets/actions
for your repository);- You can generate a token here and give it the
repo
scope; - This is needed for the
gh-pages
deployment (so the action can push to thegh-pages
branch);
- You can generate a token here and give it the
- Repository variable
VITE_APP_BACKEND_ROOT_ENDPOINT
(access the equivalent ofhttps://github.com/ArielMAJ/fullstack-vue-fastapi-template/settings/variables/actions
for your repository);- Set the value to the root endpoint of your backend (e.g.
https://fullstack-vue-fastapi-template.vercel.app/
); - This is needed for the frontend to know where the backend is located, this way you can easily change the backend location without changing the code (e.g. development will point to
http://localhost:3000/
and production will point to the PROD backend);
- Set the value to the root endpoint of your backend (e.g.
I personally recommend Vercel for the backend, as it is the easiest to set up and use and it's free for personal projects. The vercel.json file is already set up for this, but you're gonna need to change the root directory to your backend directory in Vercel:
Make sure to add any environment variables you create for your API in the Environment Variables section of the Vercel Project Settings.
Obs.: The backend packages are locally managed with poetry
, but, for simplicity in Vercel deployment, the requirements.txt
file is present in the folder as well. You can generate the requirements.txt
file with the command poetry export -f requirements.txt --output requirements.txt --without-hashes
in the backend
directory. If you use the pre-commit hook, it will automatically generate the requirements.txt
file for you when you commit.
- Linux: works and is the primary development platform;
- WSL: should work;
- Windows: should work. The initial development stages were in Windows, but later Linux only;
- MacOS: not tested.
Any and everyone is welcome to test this tool locally and leave feedback in the discussions/issues page. If you have some free time and are interested in it, please do. I would love to hear your thoughts and suggestions.
If you want to contribute to the project in any way, feel free to start issues, discussions and open pull requests. Check the CONTRIBUTING file for more information.
This project is licensed under the MIT License - see the LICENSE file for details.