Overview
About
Welcome to the Nanoservice-TS examples section! Here, you will find practical examples demonstrating how to use Nanoservice-TS to build various types of applications and implement common patterns. Each example is designed to be a hands-on guide, complete with explanations and code snippets.
Getting Started with Examples
These examples are structured as self-contained projects that can be easily integrated into a standard Nanoservice-TS project created with nanoctl
.
To run these examples, you will need:
- A Nanoservice-TS project set up (see First Steps).
- The
nanoctl
CLI tool. - Any specific dependencies mentioned in the individual example (e.g., database clients, external API keys if applicable).
Each example has its own documentation with detailed setup instructions, code explanations, and usage guidelines.
Available Examples
Here are the examples covered in this documentation. Click on each link to explore the detailed guide:
-
Countries API Example: A simple example demonstrating how to create a workflow that fetches data from an external API using the built-in
@nanoservice-ts/api-call
node. This example shows how to retrieve a list of countries and their capitals from a public API and return the data as a JSON response. -
Database Smart Query (DB Manager): An advanced example showcasing how to create an AI-powered database query interface. This example demonstrates how to build a workflow that allows users to query a PostgreSQL database using natural language prompts, which are then converted to SQL queries using AI. It includes a complete UI, dynamic database schema introspection, and real-time query execution.
How to Use This Section
- Choose an example: Select either the simple Countries API example or the more advanced DB Manager example based on your needs.
- Read the overview: Each example page starts with a description of its purpose and what it demonstrates.
- Examine the code: Review the Node implementations and the Workflow definitions provided in the documentation.
- Follow setup instructions: Make sure to follow the specific setup steps (e.g., installing dependencies, setting environment variables).
- Run the example: Execute the workflow as described, usually by starting the Nanoservice runner and accessing it via a browser or API client.
- Experiment: Modify the example code to better understand its workings or to adapt it to your own needs.
These examples are intended to be a starting point. We encourage you to build upon them and explore the full potential of Nanoservice-TS.
If you have an idea for a new example or want to contribute, please check our Contributing Guide.