* draft fixes: - added cc and bcc when saving drafts - save drafts less aggresively * some fixes for saving attachments to draft * fix for empty draft loading * fix draft list recipient name/address * also show 'No Recipient' if empty * remove comments * switch to mimetext for draft saving to keep formatting consistent * add message title to draft list * feat: single api for oauth connections * fix: add extra error handling * chore: simplify and fix the dev env * Ai generate security (#706) * Create prompts with XML formatting * Include XML formatted prompts in generate func * remove unused regex and add helper functions/warnings * error handling * Update apps/mail/lib/prompts.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * lint issues * Update prompts.ts * https://github.com/Mail-0/Zero/pull/706#discussion_r2049650081 Coderabbit fix 1 * erabbitai bot 3 days ago ⚠️ Potential issue errorOccurred state is stale inside finally React state setters (setErrorOccurred) are asynchronous; the errorOccurred value captured at render time will not yet reflect changes made earlier in the same event loop. Consequently, the logic deciding whether to collapse/expand may run with an outdated flag. - } finally { - setIsLoading(false); - if (!errorOccurred || isAskingQuestion) { - setIsExpanded(true); - } else { - setIsExpanded(false); // Collapse on errors - } - } + } finally { + setIsLoading(false); + // Use a local flag to track errors deterministically + const hadError = isAskingQuestion ? false : !!errorFlagRef.current; + setIsExpanded(!hadError); + } You can create const errorFlagRef = useRef(false); and update errorFlagRef.current = true every time an error is detected, ensuring reliable behaviour irrespective of React batching. Committable suggestion skipped: line range outside the PR's diff. * https://github.com/Mail-0/Zero/pull/706#discussion_r2049650112 * https://github.com/Mail-0/Zero/pull/706#discussion_r2049650106 * https://github.com/Mail-0/Zero/pull/706#discussion_r2049650097 --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Add a new Vietnamese translation file to support Vietnamese language users (#726) * feat(i18n): add Vietnamese language support Add Vietnamese ('vi') to the list of supported languages in the i18n configuration and JSON file to expand language options. * Add a new Vietnamese translation file to support Vietnamese language users. * Clear Vietnamese translation strings * Update es.json (#710) Co-authored-by: needle <122770437+needleXO@users.noreply.github.com> * Update app manifest and add new icons for PWA (#739) * feat: allow sending from email aliases added through gmail (#743) * Refactor IP handling in early-access routes * Add unauthorized error handling in sign out function --------- Co-authored-by: Ahmet Kilinc <akx9@icloud.com> Co-authored-by: BlankParticle <blankparticle@gmail.com> Co-authored-by: grim <75869731+ripgrim@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Chánh Đại <dai@chanhdai.com> Co-authored-by: Dani B. <danibaldomirm@gmail.com> Co-authored-by: needle <122770437+needleXO@users.noreply.github.com> Co-authored-by: Humber Nieto <56887259+humbernieto@users.noreply.github.com> Co-authored-by: Atharva Deosthale <atharva.deosthale17@gmail.com>
6.7 KiB
Contributing to 0.email
Thank you for your interest in contributing to 0.email! We're excited to have you join our mission to create an open-source email solution that prioritizes privacy, transparency, and user empowerment.
Table of Contents
Getting Started
-
Fork the Repository
- Click the 'Fork' button at the top right of this repository
- Clone your fork locally:
git clone https://github.com/YOUR-USERNAME/Zero.git
-
Set Up Development Environment
Development Workflow
-
Start the Development Environment
# Start database locally bun docker:up # Start the development server bun dev -
Create a New Branch
Always create a new branch for your changes:
git checkout -b feature/your-feature-name # or git checkout -b fix/your-bug-fix -
Make Your Changes
- Write clean, maintainable code
- Follow our coding standards
- Add/update tests as needed
- Update documentation if required
-
Test Your Changes
- Make sure the app runs without errors
- Test your feature thoroughly
-
Commit Your Changes
- Use clear, descriptive commit messages
- Reference issues and pull requests
git commit -m "feat: add new email threading feature Implements #123" -
Stay Updated
Keep your fork in sync with the main repository:
git fetch upstream git merge upstream/main -
Push to Your Fork
git push origin your-branch-name -
Submit a Pull Request
- Go to your fork on GitHub and click "New Pull Request"
- Fill out the PR template completely
- Link any relevant issues
- Add screenshots for UI changes
Database Management
Zero uses PostgreSQL with Drizzle ORM. Here's how to work with it:
-
Database Structure
The database schema is defined in the
packages/db/srcdirectory. -
Common Database Tasks
# Apply schema changes to development database bun db:push # Create migration files after schema changes bun db:generate # Apply migrations (for production) bun db:migrate # View and edit data with Drizzle Studio bun db:studio -
Database Connection
Make sure your database connection string is in
.envFor local development:DATABASE_URL="postgresql://postgres:postgres@localhost:5432/zerodotemail" -
Troubleshooting
- Connection Issues: Make sure Docker is running
- Schema Errors: Check your schema files for errors
Coding Guidelines
General Principles
- Write clean, readable, and maintainable code
- Follow existing code style and patterns
- Keep functions small and focused
- Use meaningful variable and function names
- Comment complex logic, but write self-documenting code where possible
JavaScript/TypeScript Guidelines
- Use TypeScript for new code
- Follow ESLint and Prettier configurations
- Use async/await for asynchronous operations
- Properly handle errors and edge cases
- Use proper TypeScript types and interfaces
- Do not use the
anytype. We will enforce strict"no-explicit-any"in the future - Ensure all code passes type checking, as builds will check for types in the future
React Guidelines
- Use functional components and hooks
- Keep components small and focused
- Use proper prop types/TypeScript interfaces
- Follow React best practices for performance
- Implement responsive design principles
Internationalization (i18n)
0.email supports multiple languages through our internationalization (i18n) system. This makes our application accessible to users worldwide. As a contributor, you play a key role in making new features available in all supported languages.
Adding Translations for New Features
When implementing new features, follow these guidelines:
-
Add English Source Strings
- Place all user-facing text in
apps/mail/locales/en.json - Organize strings according to the existing structure
- Use descriptive, hierarchical keys that identify the feature and context
- Example:
"pages.settings.connections.disconnectSuccess": "Account disconnected successfully"
- Place all user-facing text in
-
Follow i18n Formatting Standards
- Variables:
{variableName} - Pluralization:
{count, plural, =0 {items} one {item} other {items}} - Avoid string concatenation to ensure proper translation
- Variables:
-
Quality Checklist
- All visible UI text is externalized (not hardcoded)
- Strings are organized in logical sections
- Context is clear for translators
- The feature works properly with the default language
For more details about our translation process and how translators contribute, see TRANSLATION.md.
Testing
- Write unit tests for new features
- Update existing tests when modifying features
- Ensure all tests pass before submitting PR
- Include integration tests for complex features
- Test edge cases and error scenarios
Documentation
- Update README.md if needed
- Document new features and APIs
- Include JSDoc comments for functions
- Update API documentation
- Add comments for complex logic
Areas of Contribution
- 📨 Email Integration Features
- 🎨 UI/UX Improvements
- 🔒 Security Enhancements
- ⚡ Performance Optimizations
- 📝 Documentation
- 🐛 Bug Fixes
- ✨ New Features
- 🧪 Testing
Community
- Join our discussions in GitHub Issues
- Help others in the community
- Share your ideas and feedback
- Be respectful and inclusive
- Follow our Code of Conduct
Questions or Need Help?
If you have questions or need help, you can:
- Check our documentation
- Open a GitHub issue
- Join our community discussions
Thank you for contributing to 0.email! Your efforts help make email more open, private, and user-centric. 🚀