Analytics Database
MotherDuck is the serverless backend for high-performance, interactive data apps, powered by DuckDB. Connect using any standard PostgreSQL client via our Postgres endpoint, or use @motherduck/wasm-client to build WebAssembly applications that bring data to the user's browser.
Ultra-Fast: Columnar execution provides instantly responsive results for heavy analytics workloads.
Familiar & Flexible: Works with standard PostgreSQL clients and integrates easily with the Vercel stack.
Scalable: Untether analytics from your app backend database to safeguard reliability.
Start building with free monthly compute and storage.
Click on Open in MotherDuck to navigate to the MotherDuck UI. A product tour will guide you through a few queries and features in the UI.
Run npx create-next-app -e https://github.com/MotherDuck-Open-Source/nextjs-motherduck-wasm-analytics-quickstart-minimal to create a Next.js app pre-configured with the MotherDuck Wasm client.
Run vercel link to link the Next.js app to Vercel.
Now that a Vercle project is created and linked, click Connect Project to link this MotherDuck installation to the project.
Run vercel env pull .env.development.local to make the latest environment variables available to your project locally.
Follow the README instructions and launch the Next.js app locally.
At first, it should display an error message because the tables being queried haven't been created.
Navigate back to the MotherDuck UI by clicking Open in MotherDuck and create two new tables with some data.
CREATE TABLE IF NOT EXISTS my_db.main.users ( user_id BIGINT, username VARCHAR, email VARCHAR);
INSERT INTO my_db.main.users (user_id, username, email) VALUES(1, 'johndoe', 'john.doe@example.com'),(2, 'janesmith', 'jane.smith@example.com'),(3, 'bobwilson', 'bob.wilson@example.com');
CREATE TABLE IF NOT EXISTS my_db.main.orders ( order_id BIGINT, user_id BIGINT, total_amount DOUBLE, order_date TIMESTAMP WITH TIME ZONE);
INSERT INTO my_db.main.orders (order_id, user_id, total_amount, order_date) VALUES(101, 1, 45.50, '2024-01-15'),(102, 2, 78.25, '2024-02-20'),(103, 1, 32.75, '2024-03-10'),(104, 3, 95.00, '2024-04-05');
Now, navigate back to the Next.js app, click on the Refresh button and you should see a list of orders and the associated customers.
Refer to the Docs and demos get inspired and start building.
The MotherDuck Vercel integration automatically populates the following environment variables. Exercise caution and keep these secure.
MOTHERDUCK_TOKEN: A token that grants read-write access to a service account created for the integration.
MOTHERDUCK_READONLY_TOKEN: A token that grants read access to a service account created for the integration.
NOTE: You can create new tokens and revoke existing ones in the MotherDuck UI or via API
Starter Templates
View all templates