Installation and Setup
ActiveQL consists of two main packages that you can install via npm:
activeql-foundation- Core framework for GraphQL/REST API generationactiveql-active-admin- Admin UI package (optional)
Install from packages
For a new project, outside the wunder monorepo you might install the required modules from packages files. A good place would be a .packages folder in your module
npm install ../.packages/activeql-foundation-1.0.xx.tgz
# Optional: Install admin UI
npm install ../.packages/activeql-active-admin-1.0.xx.tgzInstall from source (Development)
If you want to contribute or customize ActiveQL, you can clone the source:
git clone https://github.com/WunderInsurance/wunder-monorepo.git
cd wunder-monorepo
npm installProject Structure
A typical ActiveQL project structure:
my-activeql-project/
|── .packages/
│ └── activeql-foundation-1.0.xx.tgz
│ └── activeql-admin-1.0.xx.tgz
├── bin/
│ └── server.ts # Server startup script
│ └── runtime.ts # Runtime configuration
├── domain/
│ └── config/
│ ├── user.aql.yml # Entity configurations
│ ├── product.aql.yml
│ └── ...
│ └── src/
│ └── product.ts # src files with domain logic
│ └── ...
├── admin/
│ └── active-admin-config.ts # Admin UI configuration (optional)
└── package.jsonJSON Schema (Optional)
For the best development experience in VSCode, install the YAML extension and configure it to use the ActiveQL schema:
1. Install the YAML extension:
2. Configure schema in VSCode settings (.vscode/settings.json):
{
"yaml.schemas": {
"./packages/domain-configuration.schema.json": [
"domain/config/*.aql.yml",
"domain/config/**/*.aql.yml"
]
}
}Quick Start Example
Create a minimal ActiveQL server:
1. Create server script (bin/server.ts):
import { ActiveQLServer } from 'activeql-foundation';
import { runtimeConfig } from './runtime';
(async () => {
// this will create a default runtime config with Sqlite as DataStore and DomainConfiguration in ./domain
const activeql = await ActiveQLServer.create();
activeql.start();
})();2. Create an entity config (domain/config/user.aql.yml):
entity:
User:
attributes:
email: Key
name: String!
age: Int3. Start the server:
npm run serverThen access your GraphQL API at http://localhost:4000/graphql (opens in a new tab)
Next Steps
- Server & Runtime Setup - Detailed server configuration options
- DataStore Configuration - Configure database backends
- Using ActiveQL - Learn the basics