This repository is a monorepo containing both frontend and backend code for the VTA (Visual Tangible Artefacts) project. It is part of the GIRAF ecosystem.
Table of Contents
For any questions or request for appsettings handover, contact [email protected]
Updating to latest dotnet version will likely break the package responsible for creating our swagger documentation!
-
Monorepo Structure:
All frontend, backend, and tests reside in one repository. -
Development Branches:
dev-main
: Main integration branch. Features should be merged here first and tested.main
: Production branch. Code fromdev-main
is merged here after passing CI and review.
-
CI/CD Setup:
- CI runs on GitHub-hosted runners for all pushes/PRs to
dev-main
ormain
. - CD runs on a self-hosted runner when changes are merged into
main
. - Workflows are defined in
.github/workflows/
. - Automated test runs use Docker and Testcontainers to create a clean MySQL environment for integration tests.
- CI runs on GitHub-hosted runners for all pushes/PRs to
-
GitHub Projects & Issues:
Task management uses GitHub Projects.- Opening a new issue triggers a workflow that sets a start date.
- Closing an issue triggers a workflow that sets an end date.
- These workflows require a
GIT_TOKEN
secret in GitHub Actions.
-
Protected Branches & Reviews:
- Direct pushes to
main
are blocked. - A PR from
dev-main
tomain
requires passing tests and at least one reviewer approval. - Admins can override in emergencies if needed.
- Direct pushes to
-
Secrets and Configurations:
- All sensitive data is stored in GitHub Secrets (
Settings -> Secrets and variables -> Actions
). - Example secrets:
GIT_TOKEN
,JWT_SECRET
,TEST_CONNECTION_STRING
. - CI/CD, Docker-based tests, and API deployments rely on these secrets.
- All sensitive data is stored in GitHub Secrets (
-
Testing Environment:
- Tests run automatically via
dotnet test
in CI. CustomApplicationFactory.cs
uses Testcontainers to spawn a temporary MySQL database.- Configuration fallback for tests (in order):
/var/www/VTA.API/appsettings.json
(VPS environment)- Local
appsettings.json
(developer machine) - Environment variables (in GitHub Actions)
- EF migrations are auto-generated at test runtime, so no manual SQL scripts are needed.
- Tests run automatically via
-
VPS & Deployment Details:
- The API is deployed to
/var/www/VTA.API/
on the VPS. - Deployment uses
rsync
to update files andsystemctl restart vtaapi.service
to restart the API. - VPS-side configuration changes (like
sudo visudo
edits) may be required for runner permissions.
- The API is deployed to
Contributions typically follow a feature-branch-based workflow:
- Create an issue: Start by opening an issue on GitHub to describe the feature, improvement, or bug fix.
- Branch off from
dev-main
: Create a new branch named after the issue (e.g.,feature/issue-123-new-ui
). - Implement and Test: Develop your changes locally, add tests where applicable, and ensure all tests pass.
- Pull Request and Review: Open a pull request (PR) from your feature branch into
dev-main
. If you’re uncertain about the correctness, request a code review. - Merge to
main
: After your code is tested and approved, it will be merged fromdev-main
intomain
for deployment.
Tip: Sometimes it helps to merge dev-main
into your feature branch first to test against production-ready code, then finalize your changes and open a PR to merge into main
(once the group agrees dev-main
should enter main
.)
Branching Strategy Overview:
We follow a DB-first approach, meaning the database schema is the source of truth, and code models are generated from it.
Workflow:
- Design the database schema: Define tables, relationships, and constraints in the database directly.
- Generate models from DB:
Usedotnet ef
scaffold commands to generate or update model classes:This regenerates the entire DB context and model classes. For partial updates (only certain tables):dotnet ef dbcontext scaffold "server=[server];port=[port];user=[user];password=[password];database=VTA" \ Pomelo.EntityFrameworkCore.MySql -o scaffold -f
dotnet ef dbcontext scaffold "server=[server];port=[port];user=[user];password=[password];database=VTA" \ Pomelo.EntityFrameworkCore.MySql -o scaffold --table [Table1] --table [Table2] -f
- Auto-Generated DB Contexts:
The DB context includes all tables. If concurrency or complexity is an issue, consider splitting your context into multiple smaller ones. Refer to existing contexts for examples. - Regenerate after schema changes:
Whenever the schema changes, regenerate the models to keep code and database aligned.
- Classes, Enums, Typedefs, Type Parameters:
PascalCase
(UpperCamelCase)class SliderMenu { ... } typedef Predicate<T> = bool Function(T value);
- Extensions:
PascalCase
(UpperCamelCase)extension MyFancyList<T> on List<T> { ... }
- Variables, Functions, Parameters, Named Constants:
camelCase
(lowerCamelCase)var itemCount = 3; void alignItems(bool clearItems) { ... }
- Directories and Files:
lowercase_with_underscores
lib/ my_widget.dart utils/ string_helpers.dart
- Import Prefixes:
lowercase_with_underscores
- Acronyms: Capitalize as words. For acronyms longer than two letters,
PascalCase
.class HttpRequest { ... }
- Formatting: Use
dart format
to format code.
Refer to Dart style guidelines for more details. - Documentation: Document your code! Refer to Dart documentation guidelines.
- Classes, Enums, Structs:
PascalCase
class MyClass { ... } enum Colors { Red, Green, Blue }
- Methods, Properties, Events:
PascalCase
public void FetchData() { ... } public string Name { get; set; }
- Variables, Parameters:
camelCase
int itemCount = 3; void SetItemCount(int itemCount) { ... }
- Constants:
PascalCase
withconst
const int MaxItems = 10;
- Interfaces: Prefix with
I
+PascalCase
public interface IMyInterface { ... }
- Namespaces:
PascalCase
namespace MyApplication.Data { ... }
- Files: One type per file, named after the type (
PascalCase
)MyClass.cs IMyInterface.cs Colors.cs
- Acronyms: Treat acronyms as words (
HttpRequest
,IOHandler
) - Formatting: Follow C# Coding Conventions.
- Documentation: Use XML comments (
///
) and follow Microsoft documentation guidelines.