SvelteKit + Azure Functions + MapLibre + Azure Table Storage
This repo is my starter scaffold to build a single-page app that shows geo-located text data stored in Azure Table Storage. It includes:
functions/) that exposes an HTTP endpoint to list geo posts from a table called GeoPosts.app/) that uses MapLibre to display the posts on a map.Quick steps
npm i -g azure-functions-core-tools@4 --unsafe-perm true
cd functions
npm install
# set TABLE_CONNECTION_STRING in local.settings.json or environment
npm run populate # optional: populate sample data
func start # runs function locally on http://localhost:7071
cd app
npm install
npm run dev # runs SvelteKit dev server (proxies /api to localhost:7071)
Notes
TABLE_CONNECTION_STRING (and optionally TABLE_NAME) in functions/local.settings.json or environment.ADMIN_PASSWORD in Functions settings (local and Azure) for /admin moderation endpoints./api to the local function runtime so fetch('/api/getPosts') works during dev.API endpoints
GET /api/getPosts — lists all posts from the GeoPosts table.POST /api/addPost — create a new post. JSON payload: { "text": "...", "latitude": 47.6, "longitude": -122.3 }.Deploy to Azure Static Web Apps
This repo is set up to deploy from GitHub Actions using:
app_location: appapi_location: functions (not api)output_location: buildOne-time setup:
Deployment token and copy the token value.Settings > Secrets and variables > Actions and add:AZURE_STATIC_WEB_APPS_API_TOKENmain.GitHub Actions workflow file:
.github/workflows/azure-static-web-apps.yml