Develop your application from scratch

The development of a new application often involves significant overhead in implementing foundational infrastructure. The Base Template addresses this challenge by providing a comprehensive starting point with pre-configured essential APIs for user and role management. This template eliminates the need to develop common application scaffolding, allowing you to concentrate on implementing unique, value-added features.

Base Template: What It Is and Why It Matters

Base Template provides a ready-to-use foundation with essential configurations and functionality, saving you from writing repetitive boilerplate code.

Below is the folder structure of this template.

<span><span style="color: var(--shiki-token-function)">├──</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">README.md</span></span>
<span><span style="color: var(--shiki-token-function)">├──</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">application</span></span>
<span><span style="color: var(--shiki-token-function)">│  </span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">└──</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">app.cue</span></span>
<span><span style="color: var(--shiki-token-function)">├──</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">cue.mod</span></span>
<span><span style="color: var(--shiki-token-function)">│  </span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">├──</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">module.cue</span></span>
<span><span style="color: var(--shiki-token-function)">│  </span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">└──</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">pkg</span></span>
<span><span style="color: var(--shiki-token-function)">├──</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">environment</span></span>
<span><span style="color: var(--shiki-token-function)">│  </span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">└──</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">env.cue</span></span>
<span><span style="color: var(--shiki-token-function)">├──</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">seed</span></span>
<span><span style="color: var(--shiki-token-function)">│  </span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">├──</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">master</span></span>
<span><span style="color: var(--shiki-token-function)">│  </span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">│  </span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">├──</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">roles.cue</span></span>
<span><span style="color: var(--shiki-token-function)">│  </span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">│  </span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">└──</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">users.cue</span></span>
<span><span style="color: var(--shiki-token-function)">│  </span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">└──</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">utils</span></span>
<span><span style="color: var(--shiki-token-function)">│  </span><span style="color: var(--shiki-color-text)">     </span><span style="color: var(--shiki-token-string)">└──</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">uuid.cue</span></span>
<span><span style="color: var(--shiki-token-function)">├──</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">services</span></span>
<span><span style="color: var(--shiki-token-function)">│  </span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">├──</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">auth</span></span>
<span><span style="color: var(--shiki-token-function)">│  </span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">│  </span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">└──</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">auth.cue</span></span>
<span><span style="color: var(--shiki-token-function)">│  </span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">├──</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">pipeline</span></span>
<span><span style="color: var(--shiki-token-function)">│  </span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">│  </span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">├──</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">pipeline.cue</span></span>
<span><span style="color: var(--shiki-token-function)">│  </span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">│  </span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">├──</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">resolvers</span></span>
<span><span style="color: var(--shiki-token-function)">│  </span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">│  </span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">└──</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">settings.cue</span></span>
<span><span style="color: var(--shiki-token-function)">│  </span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">└──</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">tailordb</span></span>
<span><span style="color: var(--shiki-token-function)">│  </span><span style="color: var(--shiki-color-text)">     </span><span style="color: var(--shiki-token-string)">├──</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">master</span></span>
<span><span style="color: var(--shiki-token-function)">│  </span><span style="color: var(--shiki-color-text)">     </span><span style="color: var(--shiki-token-string)">├──</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">permissions.cue</span></span>
<span><span style="color: var(--shiki-token-function)">│  </span><span style="color: var(--shiki-color-text)">     </span><span style="color: var(--shiki-token-string)">└──</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">tailordb.cue</span></span>
<span><span style="color: var(--shiki-token-function)">└──</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string)">workspace.cue</span></span>
<span></span>

To get started with any Tailor PF application, the folders and files listed above are the essential minimum.

Application

The app.cue file serves as the application's entry point. It defines the application's behavior through subgraphs and includes configuration for user authentication and CORS.

In the Base Template, the tailordb and pipeline services are predefined.

Workspace

A Workspace is the top-level namespace in the Tailor platform for your organization. It's where you host your applications and specify the services they use.

Application configuration

The cue.mod folder contains all the app configurations.

Environment

The env.cue file allows you to specify and manage environment-specific variables for your application. To customize your application, locate the application name definition within this file and update it.

Services

The services folder is where you define all the application's services. This provides a centralized location for service-related configurations and implementations.

The tailordb service is crucial for data management. The folder contains three main components:

  1. master: Stores fundamental user and role types that are essential for most applications

  2. permissions.cue: Defines CRUD (Create, Read, Update, Delete) operation permissions

  3. tailordb.cue: The central file where all data types for the application must be registered

You have flexibility in organizing your data structures within this folder while maintaining the core structure.

The auth service manages authentication and authorization configurations for the application. Specifically, it handles:

  1. Identity Provider (IdP) configurations: Settings for authenticating users through trusted identity providers

  2. OAuth client setup: Configuration for enabling secure, token-based authentication with external services

The pipeline serivice manages the application's business logic and the folder contains:

  1. resolvers: Contains the actual resolvers

  2. settings.cue: Configuration settings for pipelines

  3. pipeline.cue: The file where all resolvers must be registered to be accessible by the application

Tutorial Roadmap

This tutorial aims to provide a simple step-by-step guide on how to develop a project management application using the Base Template.

  1. Design Data Models: Use the tailordb service to create comprehensive data models that define the structure and relationships for projects and tasks.

  2. Configure Authentication: Configure IdP and OAuth clients utilizing the auth service.

  3. Develop Business Logic: Implement a getProjectStatus pipeline that efficiently retrieves a project's details and the status of its associated tasks, providing a holistic view of project progress.

  4. Implement Automated Status Management: Create an executor that automatically updates the project status when all child tasks have been successfully completed, ensuring real-time tracking and minimal manual intervention.