### Start Baserow Development Environment
Source: https://github.com/baserow/plugin-boilerplate/blob/main/README.md
Navigate to your plugin directory and run these commands to build and start the Dockerized development environment for Baserow. Ensure Docker buildkit is enabled and set user/group IDs to prevent permission issues.
```bash
cd my-baserow-plugin
# Enable Docker buildkit
export COMPOSE_DOCKER_CLI_BUILD=1
export DOCKER_BUILDKIT=1
# Set these variables so the images are built and run with the same uid/gid as your
# user. This prevents permission issues when mounting your local source into
# the images.
export PLUGIN_BUILD_UID=$(id -u)
export PLUGIN_BUILD_GID=$(id -g)
# You can optionally `export COMPOSE_FILE=docker-compose.dev.yml` so you don't need to
# use the `-f docker-compose.dev.yml` flag each time.
docker-compose -f docker-compose.dev.yml up -d --build
docker-compose -f docker-compose.dev.yml logs -f
```
--------------------------------
### Register Example API URL
Source: https://github.com/baserow/plugin-boilerplate/blob/main/README.md
Modify the `urls.py` file to include the new API endpoint. This maps the URL pattern '/example/' to the `ExampleView`.
```python
from django.urls import re_path
from .views import StartingView, ExampleView
app_name = 'my_baserow_plugin.api'
urlpatterns = [
re_path(r"starting/$", StartingView.as_view(), name="starting"),
re_path(r'example/$', ExampleView.as_view(), name='example'),
]
```
--------------------------------
### Add Example API View
Source: https://github.com/baserow/plugin-boilerplate/blob/main/README.md
Define a new API view in `views.py` to handle requests and return a JSON response. This example creates a simple view that returns a title and content.
```python
class ExampleView(APIView):
permission_classes = (AllowAny,)
def get(self, request):
return Response({
'title': 'Example title',
'content': 'Example text'
})
```
--------------------------------
### Run Baserow Plugin with Single Docker Compose
Source: https://github.com/baserow/plugin-boilerplate/blob/main/plugin-boilerplate/{{ cookiecutter.project_slug }}/README.md
Use this command to run your plugin installed in a single container. This is the simplest setup for testing.
```bash
docker-compose up
```
--------------------------------
### Run Baserow Plugin with Multi-Service Docker Compose
Source: https://github.com/baserow/plugin-boilerplate/blob/main/plugin-boilerplate/{{ cookiecutter.project_slug }}/README.md
Deploy your plugin across multiple services behind a Caddy reverse proxy. This setup is more complex but mirrors a production-like environment.
```bash
docker-compose -f docker-compose.multi-service.yml up -d --build
```
--------------------------------
### Define New Route in Web Frontend
Source: https://github.com/baserow/plugin-boilerplate/blob/main/README.md
Add this JavaScript code to your plugin's routes file to define a new route for your example page. Ensure the component path is correct.
```javascript
import path from 'path'
export const routes = [
{
name: 'starting',
path: '/starting',
component: path.resolve(__dirname, 'pages/starting.vue'),
},
{
name: 'example',
path: '/example',
component: path.resolve(__dirname, 'pages/example.vue'),
},
]
```
--------------------------------
### Create Example Vue Component
Source: https://github.com/baserow/plugin-boilerplate/blob/main/README.md
This Vue component fetches data from a Baserow API endpoint using `asyncData` and displays it. Remember to update the URL prefix to match your plugin's name.
```vue
{{ content }}
```
--------------------------------
### Run Backend Linters
Source: https://github.com/baserow/plugin-boilerplate/blob/main/README.md
Navigate to the backend directory within the development container and execute these commands to run Black for formatting and Flake8 for linting.
```bash
cd /baserow/data/plugins/my_baserow_plugin/backend/
```
```bash
black .
```
```bash
flake8
```
--------------------------------
### Run Baserow Plugin in Development Mode (All-in-One)
Source: https://github.com/baserow/plugin-boilerplate/blob/main/plugin-boilerplate/{{ cookiecutter.project_slug }}/README.md
Utilize this command for development, running a Baserow all-in-one image with your plugin. It mounts local source code for hot code reloading.
```bash
docker-compose -f docker-compose.dev.yml up -d --build
```
--------------------------------
### Run Baserow Plugin in Development Mode (Multi-Service)
Source: https://github.com/baserow/plugin-boilerplate/blob/main/plugin-boilerplate/{{ cookiecutter.project_slug }}/README.md
Configure a multi-service development environment where each Baserow service runs in a separate container with your plugin. Local source code is mounted for hot code reloading.
```bash
docker-compose -f docker-compose.multi-service.dev.yml up -d --build
```
--------------------------------
### Create New Baserow Plugin
Source: https://github.com/baserow/plugin-boilerplate/blob/main/README.md
Use this command to generate a new Baserow plugin project using the cookiecutter template. You will be prompted to provide project details.
```bash
cookiecutter gl:baserow/baserow --directory plugin-boilerplate
project_name [My Baserow Plugin]:
project_slug [my-baserow-plugin]:
project_module [my_baserow_plugin]:
```
--------------------------------
### Set Up Docker Build Environment Variables
Source: https://github.com/baserow/plugin-boilerplate/blob/main/plugin-boilerplate/{{ cookiecutter.project_slug }}/README.md
Configure environment variables to enable Docker buildkit and set user/group IDs for your local source code. This prevents permission issues when mounting local source into Docker containers.
```bash
# Enable Docker buildkit
export COMPOSE_DOCKER_CLI_BUILD=1
export DOCKER_BUILDKIT=1
# Set these variables so the images are built and run with the same uid/gid as your
# actual user. This prevents permission issues when mounting your local source into
# the images.
export PLUGIN_BUILD_UID=$(id -u)
export PLUGIN_BUILD_GID=$(id -g)
```
--------------------------------
### Run Frontend Linters
Source: https://github.com/baserow/plugin-boilerplate/blob/main/README.md
Execute these commands within the Baserow development container to run ESLint and Stylelint for frontend code quality checks.
```bash
docker-compose -f docker-compose.dev.yml exec my-baserow-plugin /baserow.sh backend-cmd bash -c bash
```
```bash
cd /baserow/data/plugins/my_baserow_plugin/web-frontend/
```
```bash
yarn run eslint --fix
```
```bash
yarn run stylelint
```
```bash
yarn add your_dependency
```
--------------------------------
### Restart Nuxt Development Server
Source: https://github.com/baserow/plugin-boilerplate/blob/main/README.md
After modifying routes, restart the Nuxt development server using this Docker command to apply the changes.
```bash
docker-compose -f docker-compose.dev.yml restart
```
--------------------------------
### Grant Database Creation Permission
Source: https://github.com/baserow/plugin-boilerplate/blob/main/README.md
Before running pytest database tests, ensure your database user has the CREATEDB permission by executing this command.
```bash
docker-compose -f docker-compose.dev.yml exec -T my-baserow-plugin /baserow/supervisor/docker-postgres-setup.sh run <<< "ALTER USER baserow CREATEDB;"
```
--------------------------------
### Run Pytest Database Tests
Source: https://github.com/baserow/plugin-boilerplate/blob/main/README.md
Execute these commands within the development container to run your plugin's pytest database tests.
```bash
docker-compose -f docker-compose.dev.yml exec my-baserow-plugin /baserow.sh backend-cmd bash -c bash
```
```bash
cd /baserow/data/plugins/my_baserow_plugin/backend/
```
```bash
pytest
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.