Skip to content

Shared Resources & Workflows

This document covers the shared resources, common workflows, and cross-project standards used across all OpticWorks engineering projects.

All repositories are hosted under the r-mccarty GitHub account:

RepositoryDescriptionPrimary Language
hardwareOSRS-1 embedded OSC, Go, TypeScript
presence-dectection-engineESP32 presence sensingC++, Python
opticworks-storeE-commerce platformTypeScript
opticworks-intranetThis intranet siteTypeScript
ServiceProviderPurposeProjects
Cloudflare WorkersCloudflareEdge computeStore
Cloudflare R2CloudflareObject storageAll
Cloudflare AccessCloudflareZero-trust authIntranet
Hetzner CloudHetznerVPS hostingStore backend
GitHub ActionsGitHubCI/CDAll
ServicePurposeProjects
StripePaymentsStore
EasyPostShippingStore
ResendEmailStore
HookdeckWebhooksStore
PagerDutyAlertingAll production

All projects follow the same branching strategy:

main (production)
├── develop (staging)
│ │
│ ├── feature/new-feature
│ ├── fix/bug-description
│ └── chore/cleanup-task
└── hotfix/critical-fix (emergency only)

Branch Naming:

  • feature/ - New features
  • fix/ - Bug fixes
  • chore/ - Maintenance tasks
  • docs/ - Documentation updates
  • hotfix/ - Emergency production fixes

Use Conventional Commits:

<type>(<scope>): <description>
[optional body]
[optional footer(s)]

Types:

  • feat - New feature
  • fix - Bug fix
  • docs - Documentation
  • style - Formatting
  • refactor - Code restructuring
  • test - Tests
  • chore - Build/tooling

Examples:

feat(fusion): add Kalman filter velocity estimation
fix(cart): resolve race condition in quantity update
docs(readme): update installation instructions
  1. Create PR from feature branch to develop
  2. Fill template with description, testing steps, screenshots
  3. Request review from appropriate team member
  4. Address feedback and update code
  5. Squash merge after approval
  6. Delete branch after merge

PR Template:

## Summary
Brief description of changes
## Type of Change
- [ ] Feature
- [ ] Bug fix
- [ ] Documentation
- [ ] Refactoring
## Testing
- [ ] Unit tests added/updated
- [ ] Manual testing completed
- [ ] E2E tests pass
## Screenshots
(if applicable)
## Checklist
- [ ] Code follows style guidelines
- [ ] Self-reviewed code
- [ ] Documentation updated
- [ ] No breaking changes (or documented)

Reviewers should check:

  • Code correctness and logic
  • Test coverage
  • Performance implications
  • Security considerations
  • Documentation
  • Style consistency

Authors should:

  • Keep PRs small (<400 lines)
  • Respond to feedback within 24 hours
  • Don’t merge your own PRs (unless trivial)

Common mathematical utilities:

import { KalmanFilter, HungarianAlgorithm } from '@opticworks/math';
// Kalman filtering
const kf = new KalmanFilter({ processNoise: 0.1 });
kf.predict(dt);
kf.update(measurement);
// Hungarian algorithm
const assignment = HungarianAlgorithm.solve(costMatrix);

Used by: hardwareOS, presence-detection-engine

Configuration management:

import { loadConfig, getEnvVar } from '@opticworks/config';
const config = loadConfig({
apiUrl: getEnvVar('API_URL', 'http://localhost:3000'),
debug: getEnvVar('DEBUG', 'false') === 'true',
});

Used by: All projects

Lint and Test:

name: CI
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npm run lint
- run: npm run test

Deploy on Tag:

name: Deploy
on:
push:
tags: ['v*']
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npm run build
- run: npm run deploy
env:
DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
SecretProjectsPurpose
CLOUDFLARE_API_TOKENAllCloudflare deployments
STRIPE_SECRET_KEYStorePayment processing
EASYPOST_API_KEYStoreShipping
SIGNING_KEYhardwareOSFirmware signing
ProjectUnit TestsIntegrationE2E
hardwareOS80%RequiredOptional
presence-engine70%RequiredOptional
opticworks-store70%RequiredRequired
describe('ComponentName', () => {
describe('methodName', () => {
it('should do expected behavior when condition', () => {
// test
});
it('should throw error when invalid input', () => {
// test
});
});
});

TypeScript/JavaScript:

/**
* Calculate the optimal assignment between tracks and detections.
*
* @param costMatrix - NxM matrix of assignment costs
* @returns Array of [trackIndex, detectionIndex] pairs
* @throws {Error} If cost matrix is empty
*/
function hungarianSolve(costMatrix: number[][]): [number, number][] {
// implementation
}

C:

/**
* @brief Update the Kalman filter with a new measurement.
*
* @param kf Pointer to the Kalman filter state
* @param measurement The new measurement value
* @return 0 on success, -1 on error
*/
int kalman_update(kalman_filter_t *kf, float measurement);

Every repository should have:

  • Project description
  • Installation instructions
  • Quick start guide
  • Contributing guidelines
  • License information
ChannelPurposeMembers
#engineeringGeneral engineeringAll engineers
#hardware-engineeringhardwareOS, firmwareHardware team
#web-engineeringStore, frontendWeb team
#open-sourcePresence engine, communityOSS team
#platformInfrastructure, CI/CDPlatform team
#incidentsProduction issuesAll on-call
MeetingFrequencyAttendees
Engineering StandupDaily, 9:30 AM PTAll engineers
Sprint PlanningBi-weekly, MondayTeam leads
Architecture ReviewMonthlySenior engineers
Demo DayBi-weekly, FridayAll company
  • Tech Talks: Monthly presentations on new tech
  • Code Reviews: Learning through PR reviews
  • Documentation: This intranet!
  • Pair Programming: Encouraged for complex tasks

All projects use Semantic Versioning:

MAJOR.MINOR.PATCH
- MAJOR: Breaking changes
- MINOR: New features (backwards compatible)
- PATCH: Bug fixes (backwards compatible)
  1. Prepare

    • All tests passing
    • CHANGELOG updated
    • Version bumped
    • Documentation updated
  2. Release

    • Create git tag
    • Push tag to trigger deployment
    • Monitor deployment
  3. Verify

    • Production health checks pass
    • Smoke tests complete
    • No error rate increase
  4. Communicate

    • Announce in Slack
    • Update status page if needed
    • Notify stakeholders
  • Never commit secrets to git
  • Use environment variables
  • Rotate secrets regularly
  • Use GitHub Secrets for CI/CD
  • Keep dependencies updated
  • Review security advisories
  • Use npm audit / cargo audit
  • Pin versions in production
  • Input validation on all boundaries
  • Parameterized queries (no SQL injection)
  • Output encoding (no XSS)
  • Authentication on all sensitive endpoints
  1. Check this intranet first
  2. Search repository READMEs
  3. Check /docs folders in repos
  1. Ask in relevant Slack channel
  2. Reach out to project owner
  3. Schedule a pairing session
  1. Technical issues → Engineering Lead
  2. Access issues → IT Support
  3. Security concerns → Security Lead

New engineers should:

  • Complete general onboarding
  • Set up development environment
  • Clone relevant repositories
  • Join appropriate Slack channels
  • Meet with team lead
  • Complete first PR (documentation or small fix)
  • Shadow an on-call rotation