FM-Calendar is a FamilyManager module that provides comprehensive calendar and event management capabilities. Built on the FamilyManager SDK, it offers seamless integration with Google Calendar and iCal, along with robust event management features for families.
- Event management (CRUD operations)
- Google Calendar synchronization
- iCal support and export
- Family calendar management
- Recurring events
- Event notifications
- Real-time updates
- Calendar views (month, week, day)
- Event creation/editing forms
- Calendar settings panel
- Event details modal
- Calendar sharing interface
- Notification preferences
- Integration widgets
npm install @familymanager/calendar --saveimport { CalendarModule } from '@familymanager/calendar';
import { ModuleContext } from '@familymanager/sdk';
export class Calendar extends CalendarModule {
async initialize(context: ModuleContext): Promise<void> {
// Initialize module
await this.setupDatabase();
await this.registerRoutes();
await this.setupGoogleCalendarSync();
this.setupEventHandlers();
}
}import {
CalendarView,
EventForm,
CalendarSettings
} from '@familymanager/calendar/components';
function CalendarPage() {
return (
<div>
<CalendarView />
<EventForm />
<CalendarSettings />
</div>
);
}import { useEventListener } from '@familymanager/sdk';
function CalendarComponent() {
useEventListener('calendar:event-created', (data) => {
// Handle new event
});
}GET /api/calendar/events: List all eventsPOST /api/calendar/events: Create new eventGET /api/calendar/events/:id: Get event detailsPUT /api/calendar/events/:id: Update eventDELETE /api/calendar/events/:id: Delete eventGET /api/calendar/events/family/:familyId: List family events
GET /api/calendar/settings: Get calendar settingsPUT /api/calendar/settings: Update settingsPOST /api/calendar/sync: Trigger syncGET /api/calendar/export/:id: Export calendar
calendar:event-createdcalendar:event-updatedcalendar:event-deletedcalendar:sync-completed
family:member-addedfamily:member-removedtasks:due-date-changed
model Calendar {
id String @id @default(uuid())
name String
familyId String
color String?
isDefault Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
events Event[]
}
model Event {
id String @id @default(uuid())
calendarId String
title String
description String?
startTime DateTime
endTime DateTime
location String?
isRecurring Boolean @default(false)
recurrence Json?
calendar Calendar @relation(fields: [calendarId], references: [id])
}
model CalendarSync {
id String @id @default(uuid())
calendarId String
provider String
lastSyncTime DateTime
syncToken String?
settings Json
}interface CalendarConfig {
maxEventsPerCalendar: number; // Default: 1000
defaultCalendarId?: string; // Optional default calendar
syncInterval: number; // Sync interval in seconds (default: 300)
notifyOnEventCreation: boolean; // Default: true
notifyOnEventUpdate: boolean; // Default: true
googleCalendar?: {
clientId: string;
clientSecret: string;
redirectUri: string;
};
}# Run unit tests
npm run test:unit
# Run with coverage
npm run test:coverage# Run integration tests
npm run test:integration
# Run E2E tests
npm run test:e2eimport {
createTestCalendar,
createTestEvent,
mockCalendarModule
} from '@familymanager/calendar/testing';
describe('Calendar Tests', () => {
const mockModule = mockCalendarModule();
it('handles events', async () => {
const calendar = await createTestCalendar();
const event = await createTestEvent(calendar.id);
// Test implementation
});
});- Node.js 18+
- FamilyManager SDK
- PostgreSQL
- Google Calendar API credentials (optional)
# Install dependencies
npm install
# Set up database
npm run db:setup
# Run migrations
npm run db:migrate
# Start development server
npm run dev# Build module
npm run build
# Generate documentation
npm run docs- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please ensure your contributions:
- Follow the existing code style
- Include appropriate tests
- Update relevant documentation
- Consider backward compatibility
This project is licensed under the MIT License - see the LICENSE file for details.
- @familymanager/sdk: Core SDK
- @prisma/client: Database ORM
- react: Frontend framework
- redux: State management
- googleapis: Google Calendar API
- ical.js: iCal support
- typescript: Type checking
- jest: Testing framework
- playwright: E2E testing
- eslint: Code linting
- prettier: Code formatting