npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

appwrite-fn-import-geojson

v1.2.0

Published

An Appwrite function which can receive and process a GeoJSON FeatureCollection of cadastral parcels, as a slice of a larger collection. Each parcel is stored as an individual record in a database, and the resulting, complete collection is rebuilt, cached

Readme

appwrite-fn-import-geojson

An Appwrite function which can receive and process a GeoJSON FeatureCollection of cadastral parcels, as a slice of a larger collection. Each parcel is stored as an individual record in a database, and the resulting, complete collection is rebuilt, cached and exposed as a static asset.

This README explains how to develop and test the Appwrite import function locally, using Docker for the Appwrite stack (function, database, API key) and a mock GeoJSON FeatureCollection payload.

Prerequisites

1. Start Appwrite locally

You need a local Appwrite instance with a database and a placeholder function configured. It’s all managed by Docker Compose.

docker run -it --rm \
    --volume /var/run/docker.sock:/var/run/docker.sock \
    --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \
    --entrypoint="install" \
    appwrite/appwrite:1.7.4

It generates ./appwrite/docker-compose.yml.

Add ./appwrite/.env (copy/paste https://appwrite.io/install/env).

Then, simply run docker compose up -d --remove-orphans.

TODO: automate most if not all the next steps

  • Access the Appwrite console at http://localhost:80 and create:

    • A user account
    • A project
    • A database (no collection required)
    • A Node v18+ placeholder (empty) function named "import-geojson" (it’s source code will be linked to this very repository)
    • A "localhost-cli" API key which must grant full access to everything (used by CLI commands for setting things up, debugging, etc.)
  • Edit appwrite.config.json to use the proper $id values for the project, its database and the placeholder function (beware, some values appear multiple times).

  • Create a placeholder (empty) functions named "import-geojson". Enter the function, and add a custom domain "import-geojson.functions.localhost".

  • Set the following environment variables in the function:

    • APPWRITE_ENDPOINT (e.g. "http://appwrite/v1" or a live endpoint; don’t use "http://localhost/v1" for it must use docker compose’s services’ names, it’s not for external resolution from your host machine but for an Appwrite service to communicate to another)
    • APPWRITE_PROJECT_ID
    • APPWRITE_DB_ID
    • APPWRITE_TABLE_NAME (e.g. "parcels")
  • Connect the placeholder function to this very source code, by deploying it and thus creating a first dockerized deployment:

appwrite client --endpoint http://localhost/v1 --self-signed true --project-id [PROJECT_ID] --key [SECRET_VALUE_FOR_KEY_localhost-cli]
# appwrite login # do not login, we’re using an API key instead
# appwrite functions list # you may check the cli has been properly configured

2. Push (deploy) the function

npm run appwrite:push

Running the Function on the host

For pure local testing, you may run the function on your host rather than inside Docker:

npx ts-node src/index.ts

It’s outside Appwrite’s stack though, so YMMV.

3. Send a Mock Excel file

  • Use the provided script to send a test payload to your locally deployed function:
npm run test:import-excel

3. Verify Data in Appwrite

  • Use the Appwrite console or API to check that documents have been created in a collection.

Troubleshooting

  • Ensure all required environment variables are set.
  • Check Docker logs if the Appwrite stack is not responding.
  • Check Appwrite’s console (function logs).

For more details, see the Appwrite documentation: https://appwrite.io/docs/