Skip to content

OpenShock/Frontend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

OpenShock Frontend

Documentation GitHub license GitHub Releases GitHub Sponsors Discord

master Build Status CodeQL Status
develop Build Status CodeQL Status

This is the frontend for the OpenShock project that interfaces with the OpenShock API.

Technologies

Typescript Vite SvelteKit shadcn-ui Tailwind CSS

Available Commands

  • pnpm i - Install dependencies
  • pnpm run dev - Start the development server
  • pnpm run build - Build the project
  • pnpm run preview - Preview the built project
  • pnpx openapi-generator-cli generate - Generate the API client

Setup

To get started with development, you will need to have Node.js and pnpm installed.

We recommend using a version manager like Volta to manage your Node.js versions.

Install Node.js and pnpm

Install on Linux:

curl https://get.volta.sh | bash

Install on Windows:

winget install Volta.Volta

Then you can install the required Node.js and pnpm version by running a single command in the repository root directory:

volta install node
volta install pnpm

Install dependencies and build project

With Node.js installed, you can run the following commands to get started:

pnpm i
pnpm run build

Running locally

Running the frontend locally is as simple as this:

pnpm run dev

Hosts redirect

If you do not have a hosts file config for your domain and try to run the project you will get the following example message:

Please ensure that local.openshock.app resolves to 127.0.0.1 in your hosts file

On macOS and Linux, you can do this by running the following command:
echo "127.0.0.1 local.openshock.app" | sudo tee -a /etc/hosts

On Windows, you can do this by running the following command in PowerShell as an administrator:
Add-Content -Path "C:\Windows\System32\drivers\etc\hosts" -Value "127.0.0.1 local.openshock.app"

Then restart your development server

This action is required because of cookie policy, once you have done this you should be set!

Try closing and re-opening your development environment or console to refresh its cached system config.

πŸ“‚ Project Structure

.changestes/   # Versioning and changelog automation
.github/       # GitHub workflows
e2e/           # End-to-end tests (Playwright)
patches/       # Manual patches to npm dependencies (used with patch-package)
static/        # Public assets served directly (e.g., images, icons)
src/           # Application source code
β”œβ”€β”€ lib/       # Shared modules and utilities
β”‚   β”œβ”€β”€ api/               # API clients
β”‚   β”‚   └── internal/      # Autogenerated API client (DO NOT EDIT MANUALLY)
β”‚   β”œβ”€β”€ components/        # UI components
β”‚   β”‚   β”œβ”€β”€ metadata/      # Meta helpers for SEO and accessibility
β”‚   β”‚   β”œβ”€β”€ svg/           # Customizable SVG icons
β”‚   β”‚   └── ui/            # Shadcn UI components (Do not add custom components here)
β”‚   β”œβ”€β”€ constants/         # Global constants
β”‚   β”œβ”€β”€ errorhandling/     # Error handling utilities
β”‚   β”œβ”€β”€ hooks/             # Svelte hooks
β”‚   β”œβ”€β”€ inputvalidation/   # Input validators for usage with input fields
β”‚   β”œβ”€β”€ signalr/           # SignalR real-time communication logic
β”‚   β”œβ”€β”€ stores/            # Svelte stores for global state management
β”‚   β”œβ”€β”€ typeguards/        # Type guard helpers for runtime type checking
β”‚   β”œβ”€β”€ types/             # Global TypeScript types
β”‚   └── utils/             # General utilities
β”œβ”€β”€ params/                # SvelteKit route parameter matchers
β”œβ”€β”€ routes/                # Application routes (file-based routing)
β”‚   β”œβ”€β”€ (authenticated)/   # Protected routes (everything under this folder requires authentication)
β”‚   β”‚   └── +layout.svelte # Authentication boundary and layout
β”‚   β”œβ”€β”€ +error.svelte      # Global error fallback
β”‚   └── +layout.svelte     # Root layout and entrypoint
β”œβ”€β”€ app.css    # Global styles
β”œβ”€β”€ app.d.ts   # Global type declarations
└── app.html   # HTML root template
└── error.html # Fallback HTML error page (for critical errors)

Configuration files

πŸ“¦ Node & pnpm

  • .npmrc β€” npm configuration.
  • .nvmrc β€” Node.js version manager file.
  • package.json, pnpm-lock.yaml β€” Project dependencies and lockfile.

βš™οΈ Configuration & Tooling

  • .editorconfig β€” Editor formatting consistency across IDEs.
  • .prettierrc, .prettierignore β€” Code formatting rules (Prettier).
  • eslint.config.js β€” Linting setup (ESLint).
  • tsconfig.json β€” TypeScript compiler configuration.
  • vite.config.ts β€” Vite bundler config.
  • svelte.config.js β€” SvelteKit configuration.
  • components.json β€” Component metadata for shadcn.
  • openapitools.json β€” Codegen config from OpenAPI spec.
  • playwright.config.ts β€” End-to-end testing configuration (Playwright).

🌐 Environment Variables

  • .env, .env.development, .env.production, .env.test β€” Environment-specific config files (e.g., API keys, endpoints).

🐳 Containerization

  • Dockerfile β€” Container definition for deployment or local dev.
  • .dockerignore β€” Files to exclude from Docker build context.

Support

You can support the openshock dev team here: Sponsor OpenShock

For self hosting support consider supporting us via the link above.

About

This is the rework of the current Frontend at openshock.app, for controlling shock collars over the internet.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 5