A gallery of applications, each implementing the same HTTP API for a guestbook backend, using SQL and CrateDB. Each implementation uses a different client library to communicate with CrateDB.
Accompanied with the applications, there is a dedicated test suite to verify the corresponding implementation automatically, and a guestbook frontend application for interactively communicating with the backend service.
- You need install and run CrateDB before proceeding with the software found within this repository.
- You will also need to install crash, the CrateDB CLI tool, to work with CrateDB on the command line.
- See the CrateDB Getting Started guide for help.
Once a CrateDB instance is running, create the required schema and import the country data:
crash < sql/schemas.sql
crash -c "COPY guestbook.countries FROM '$(pwd)/sql/countries.json' RETURN SUMMARY;"
Please note that the countries.json
file needs to be accessible by CrateDB.
If your instance of CrateDB does not have access to your filesystem, or you are
not working with the repository, you can use an alternative set of commands to
access the schemas.sql
and countries.json
files directly from GitHub:
curl -s https://raw.githubusercontent.com/crate/crate-sample-apps/main/sql/schemas.sql | crash
crash -c "COPY guestbook.countries FROM 'https://raw.githubusercontent.com/crate/crate-sample-apps/main/sql/countries.json' RETURN SUMMARY;"
See the developer docs about how to run and provision CrateDB using Docker.
The frontend is shared by all apps and is written in JavaScript. This frontend communicates with the backend over a REST API.
The are several implementations of the backend REST API.
- Erlang (Cowboy) (using Erlang, craterl)
- Go (Gin) (using Go, Gin, pgx, pgxscan)
- Java (Spark) (using Spark, JDBC, CrateDB JDBC driver)
- Java (Spring) (using Spring Boot, Spring Data JDBC, CrateDB JDBC driver)
- Node.js (Express) (using Node.js, Express, node-crate)
- PHP (Slim) (using PHP, Slim, PDO, crate-pdo)
- Python (Flask) (using Python, Flask, DBAPI2, crate-python)
This project is community-maintained, any contributions are welcome. See the developer docs, api specification, and the contribution docs documents for more information.
Looking for more help?
- Check out our support channels