Skip to main content

Scaffolding Your First Project

Castlecraft Architect leverages Cruft to manage project scaffolding from a Cookiecutter template. The main Architect repository itself serves as the Cookiecutter template, ensuring that your new projects start with the latest best practices and structures defined by Architect.

Prerequisites

Before you begin, ensure you have the following installed:

  1. Castlecraft Architect: You should have Architect installed and configured as per the Installation Guide.
  2. Cruft: This is a command-line tool that allows you to create projects from Cookiecutter templates and keep them updated. Install it via pip:
    pip install cruft
    Or, if using uv:
    uv pip install cruft
  3. Git: Cruft requires Git to be installed and accessible in your PATH.

Scaffolding Steps

  1. Navigate to Your Desired Projects Directory: Open your terminal and go to the directory where you want to create your new project.

    cd path/to/your/projects
  2. Create the Project using Cruft: Use the cruft create command, pointing it to the Castlecraft Architect repository.

    cruft create https://gitlab.com/castlecraft/framework/architect
  3. Answer the Cookiecutter Prompts: Cruft will invoke Cookiecutter, which will then ask you a series of questions to customize your new project. These prompts might include:

    • project_name: The human-readable name of your project (e.g., "My Awesome App").
    • project_slug: The directory name and Python package name for your project (e.g., "my_awesome_app").
    • author_name: Your name or your organization's name.
    • author_email: Your email address.
    • Other project-specific options defined in the Architect cookiecutter template.

    Provide your answers to these prompts.

  4. Project Generation: Once you've answered all the prompts, Cruft will generate your new project directory (e.g., my_awesome_app/) based on the Architect template and your inputs.

  5. Navigate into Your New Project:

    cd my_awesome_app # Or your project_slug

Inside Your New Project

Your newly scaffolded project will have a structure aligned with Domain-Driven Design principles and Castlecraft Architect's conventions. It will include:

  • A basic directory layout for application, domain, and infrastructure layers.
  • Configuration files (e.g., pyproject.toml, .env.example).
  • A .cruft.json file, which Cruft uses to track the template version and your project's specific answers. This file is crucial for updating your project with future changes from the Architect template.

You are now ready to start developing your application within this Architect-generated structure!

Next Steps

Learn how to run your newly scaffolded application and start developing features in the Running and Developing Your Application guide.

For information on keeping your project updated with changes from the Architect template, refer to the Cruft documentation.