Why Latitude?
Latitude allows you to create API endpoints on top of your database/warehouse using just SQL and embed interactive visualizations directly in your preferred frontend framework or through an iframe. It’s quick to set up, easy to maintain, and scales with your data, making it an invaluable tool for developers.
Features
- Connect to any database or data warehouse.
- Easily compose parameterized SQL queries and expose them as API endpoints.
- Built-in cache layer for lightning-fast query performance.
- Integrations with all common frontend frameworks (React, Svelte, Vue, VanillaJS).
- Optional layout engine to build standalone dashboards using Svelte and Tailwind.
- Support for embedding dashboards via iframe.
- Deploy with a single command: latitude deploy.
- SSL-ready with encrypted parameters to protect against SQL injection attacks.
- Open-source and driven by the community.
Getting Started
Follow these steps to get your sample app up and running:
1. Install Latitude
Run the following command to install the Latitude CLI globally:
npm install -g @latitude-datacli
If you’re on Windows, you may need to follow additional instructions found in the Windows setup documentation.
2. Create the Starter Project
Run this command to create a new Latitude project:
latitude start
The CLI will ask for the project name. Once provided, it will set up a new directory with a sample app for you to customize.
3. Navigate and Run the App
Change into your project directory and run the app:
cd my-new-app
latitude dev
This will launch the development server and open the sample app in your browser.
Connecting to Data Sources
To connect to your database or data warehouse, you will set it up through a simple configuration file. Here’s an example:
yaml
source.yml
type: postgres
details:
database: db
user: username
password: ••••••••••••••••
host: postgres.example.com
port: 5432
schema: public
ssl: true
It’s advisable not to store sensitive credentials directly in your configuration file. Instead, utilize environment variables. More information can be found in the documentation.
Writing Your SQL Queries
Latitude simplifies fetching data from your database. You can write SQL queries, and they will be exposed as API endpoints automatically. Here’s a helpful analogy:
Consider Latitude as a chef in a restaurant. The database is the pantry filled with ingredients (data), and your SQL queries are the recipes. Just as a chef carefully selects ingredients based on a recipe and prepares a dish for customers, Latitude allows you to define queries to extract the precise data needed, serving it via a swift API endpoint for your applications to consume.
Example SQL Query
sql
titles.sql
select id, title, release_year, type, runtime, imdb_score
from titles
where release_year between param(start_year) and param(end_year)
In this query, you’re using parameters to dynamically extract data, much like passing requests to your chef for specific dishes!
Troubleshooting
If you encounter any difficulties, try these tips:
- Make sure you have installed all required dependencies.
- Check for any syntax errors in your SQL queries.
- Ensure your database connection string is correct and that your database is accessible.
- Consult the official documentation for detailed setup instructions.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
Conclusion
Latitude offers an efficient way to connect databases with frontend applications. By providing an analytics framework that is both flexible and easy to use, it empowers developers to create and embed dynamic data visualizations without hassle.
At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

