Warning: Bocadillo is now UNMAINTAINED. Users are recommended to migrate to a supported alternative, such as Starlette or FastAPI. Please see #344 for more information.
Frontend frameworks
Modern web applications typically consist of a backend and a frontend. Bocadillo is a backend framework, but it's dead simple to integrate with modern frontend JavaScript frameworks.
Guidelines
Frontend frameworks generally have their own development tooling, including command line tools, hot reload, etc. Based on this assumption, here are some recommendations:
- In development: run 2 separate servers — one for Bocadillo, one for the frontend.
- In production, either:
- Serve the frontend build with Bocadillo. This may be enough for smaller-scale setups, and as shown in the react-example repo, this can be achieved by:
- Mounting the build directory as an extra static files directory.
- Serving the main
index.html
using templates.
- (Recommended) Deploy Bocadillo and the frontend on two separate hosts. See also Deployment for general hints on deploying Bocadillo applications. For the frontend, please refer to your framework's instructions.
- Serve the frontend build with Bocadillo. This may be enough for smaller-scale setups, and as shown in the react-example repo, this can be achieved by:
Example repos
The following example repos show how to get a development setup ready for your Bocadillo and frontend apps. Feel free to check them out, fork them, and hack them away! 🚀
Frontend framework | Repository | Description |
---|---|---|
React | react-example | Hello world example, with GraphQL setup. |
Vue.js | vue-example | URL Shortener web app, with database setup. |
CONTRIBUTING
Missing your favorite framework? Discuss it with us by opening an issue . We'd be glad to setup and work together on additional official example repos.
← Databases Deployment →