Before You Start
Segra is built with C#/.NET for the backend and React/TypeScript for the frontend. Familiarity with these technologies is helpful but not required for all contributions.
Ways to Contribute
Report Bugs
Found an issue? Report it on GitHub Issues
Suggest Features
Have an idea? Open a feature request on GitHub
Fix Issues
Browse open issues and submit pull requests
Improve Docs
Help us improve guides and documentation
Development Setup
Requirements
- Required
- Optional
- Windows 10 (build 17763 / 1809) or newer
- .NET SDK 9.0.x with Windows targeting
- Git for version control
- Bun v1.1+ for frontend tooling and git hooks
Repository Structure
First-Time Setup
Development Workflow
Running the Application
Segra has two parts that run during development:- Start Frontend (Vite)
- Start Backend (.NET)
The frontend dev server runs on Using Node/npm:
http://localhost:2882:Using Bun (recommended):Making Changes
Create a Branch
feature/- New featuresfix/- Bug fixesdocs/- Documentation changesrefactor/- Code refactoring
Make Your Changes
Edit code in your preferred IDE:
- Visual Studio 2022: Open
Segra.sln - VS Code: Open folder, install C# Dev Kit extension
Test Your Changes
- Manual testing: Run the application and verify functionality
- Check logs in
%AppData%/Segra/logs/for errors - Test on a clean Windows installation if possible
Commit Your Changes
Git hooks will automatically run:Commit message format:
- Pre-commit: Formats C# code with
dotnet format, runs Prettier/ESLint on frontend - Pre-push: Verifies no formatting drift in solution
feat:- New featurefix:- Bug fixdocs:- Documentationrefactor:- Code refactoringperf:- Performance improvementtest:- Test changes
Code Style and Formatting
Code formatting is enforced automatically via EditorConfig and git hooks.
EditorConfig Settings
Global (all files):- Line endings: CRLF
- Indent: 2 spaces
- Line endings: CRLF
- Indent: 4 spaces
C# Formatting
Formatting is handled bydotnet format:
- Pre-commit (Automatic)
- Pre-push (Verification)
- Manual Format
Formats staged
*.cs files automatically before commitFrontend Formatting
The frontend uses Prettier + ESLint with Bun:Building for Release
Backend Build
Frontend Build
Frontend/dist/.
Key Architecture Concepts
Backend Architecture
OBSService - Recording Engine
OBSService - Recording Engine
Located in
Backend/Recorder/OBSService.csResponsibilities:- OBS context initialization
- Scene and source management
- Encoder configuration
- Recording/replay buffer outputs
InitializeAsync()- Initialize OBSStartRecording()- Start recording sessionStopRecording()- Stop and cleanupSaveReplayBuffer()- Save replay buffer
GameDetectionService
GameDetectionService
Located in
Backend/Services/GameDetectionService.csResponsibilities:- Monitor Windows processes
- Detect game launches
- Auto-start recording
SettingsService
SettingsService
Located in
Backend/Services/SettingsService.csResponsibilities:- Load/save user settings
- Content folder management
- Display/audio device enumeration
ContentService
ContentService
Located in
Backend/Media/ContentService.csResponsibilities:- Metadata file creation
- Thumbnail generation
- Waveform generation
- Content library management
Frontend Architecture
The frontend is built with:- React 18 - UI framework
- TypeScript - Type safety
- Vite - Build tool and dev server
- Tailwind CSS - Styling
- DaisyUI - Component library
- WebSockets for real-time updates
- IPC for Photino.NET integration
Common Development Tasks
Adding a New OBS Source Type
Adding a New Game Integration
Adding a New Setting
Debugging
Backend Debugging
- Visual Studio
- VS Code
- Logs
- Open
Segra.sln - Set breakpoints in code
- Press F5 to start debugging
- Debugger attaches automatically
Frontend Debugging
- Browser DevTools: Inspect elements, console, network
- React DevTools: Install browser extension for component inspection
- Vite HMR: Hot Module Replacement for instant feedback
Git Hooks
Segra uses Husky + lint-staged for automated code quality:- Pre-commit
- Pre-push
Runs on
git commit:- Formats staged
*.csfiles withdotnet format - Runs Prettier on frontend staged files
- Runs ESLint on frontend staged files
If hooks don’t run, ensure Bun is on PATH in your Git shell:
Pull Request Guidelines
Before Submitting
Keep PRs Focused
- One feature or fix per PR
- Small, reviewable changes
- Avoid mixing refactoring with features
Test Thoroughly
- Test your changes manually
- Verify no regressions in existing features
- Include steps to reproduce in PR description
PR Description Template
Community
GitHub Discussions
Ask questions and discuss ideas
Issues
Report bugs and request features
Discord
Join the community chat
Follow for updates
Code of Conduct
Segra follows the Contributor Covenant Code of Conduct. Be respectful, inclusive, and collaborative.License
By contributing to Segra, you agree that your contributions will be licensed under the GPLv2 License.Segra is licensed under GPLv2, which means:
- You can use, modify, and distribute the software
- Modifications must also be GPLv2
- Source code must be made available
Getting Help
If you need help contributing:- Check existing documentation and guides
- Search GitHub Issues for similar questions
- Ask in GitHub Discussions
- Join the Discord community