SnailyCADv4
repository·main·Indexed 41 days ago
https://github.com/snailycad/snaily-cadv4An open-source, web-based Computer Aided Dispatch (CAD) system for FiveM communities, designed to facilitate police roleplaying and dispatching. It features a backend API, a frontend client, and optional Discord and FiveM integrations. The system includes specialized packages for shared configuration (@snailycad/config), permission management (@snailycad/permissions), data validation (@snailycad/schemas), and Prisma-generated database types (@snailycad/types).
What's inside SnailyCAD
- SnailyCAD is an open-source, web-based Computer Aided Dispatch (CAD) system designed specifically for FiveM communities. It provides tools for police roleplaying and dispatching, featuring optional integrations for Discord and FiveM to streamline community operations.
Overview of @snailycad/config
mainThe@snailycad/configmodule serves as a centralized repository for shared configuration constants used across the SnailyCAD ecosystem. It provides standardized definitions for common values to ensure consistency between different packages (such as the API, client, and UI). Key constants provided by this module includeSocketEventsfor WebSocket communication andCookiedefinitions for session management.Overview of SnailyCADv4 packages
mainSnailyCADv4 is composed of several specialized packages that work together to provide configuration, permission management, data validation, and utility functions. Developers building on or integrating with SnailyCADv4 will interact with these packages depending on whether they are working on the client-side, API-side, or database layer.Understand the SnailyCADv4 application structure
mainSnailyCADv4 is split into two primary application components located in the
apps/directory:api/: The backend service that powers the SnailyCADv4 API. It is responsible for processing all incoming requests and managing application state.client/: The frontend application. This is the user interface that end users interact with in their web browsers.
Use @snailycad/schemas for form and API request validation
mainThe@snailycad/schemasmodule provides the validation logic used throughout the SnailyCAD ecosystem. It is primarily used to ensure that data submitted via forms or API requests conforms to the expected structure and constraints required by the system.Use @snailycad/types to share database types
mainThe@snailycad/typesmodule provides a centralized set of TypeScript definitions used to share database types across the entire SnailyCAD ecosystem. Developers should use this package to ensure type safety and consistency when interacting with database schemas or data structures shared between different parts of the CAD.Use @snailycad/utils for client-side utilities
mainThe@snailycad/utilspackage provides a collection of utility functions primarily intended for use within the client-side application.Manage user permissions with @snailycad/permissions
mainThe@snailycad/permissionspackage centralizes all SnailyCADv4 permission definitions. It provides exported functions to programmatically check user permissions, allowing for consistent access control across the application.Access database types via @snailycad/types
mainThe@snailycad/typespackage exports TypeScript types generated by Prisma. These types represent the database schema and should be used when working with database entities to ensure type safety.Validate data with @snailycad/schemas
mainThe@snailycad/schemaspackage exports validation schemas. These schemas are used by both the client and the API to validate form fields and incoming data, ensuring data integrity.Use @snailycad/config for shared configuration
mainThe@snailycad/configpackage contains shared configuration logic used by both the API and the client to ensure consistency across the stack.Use the @snailycad/ui component library
mainThe
@snailycad/uipackage provides a collection of reusable UI components including form fields, inputs, overlays, and layout elements. You can import these components directly from the package entry point.Commonly used component categories include:
- Form Fields:
SelectField,TextField,RadioGroupField,DatePickerField,AsyncListSearchField,SwitchField, andCheckboxField. - Inputs:
InputandTextarea. - Overlays & Menus:
Popover,Dropdown,Alert,ContextMenu, andHoverCard. - Layout & Navigation:
Breadcrumbs,BreadcrumbItem,TabList,Accordion, andFormRow. - Specialized Components:
JsonEditor,MultiForm, andStatuscomponents.
- Form Fields: