A full-stack calendar application built with Next.js 16, React 19, MongoDB, and styled-components. It displays a monthly calendar view with task management per day, and automatically fetches Ukrainian public holidays from an external API.
- Node.js 18.17+ (or 20+)
- npm 9+
- A running MongoDB instance
git clone https://github.com/PLATnya/calendar_test.git
cd calendar_testnpm installCreate a .env.local file in the project root and set the MongoDB connection string:
MONGODB_URI=mongodb://localhost:27017/calendar_dbRun the built-in connection check script:
npm run db:checkThis script connects to MongoDB, prints the database name, host, port, and lists all existing collections, then disconnects.
npm run devOpen http://localhost:3000 in your browser.
git clone https://github.com/PLATnya/calendar_test.git
cd calendar_testdocker compose up --build -d| Script | Description |
|---|---|
npm run dev |
Start Next.js in development mode with hot-reload |
npm run build |
Build the application for production |
npm start |
Start the production server (requires build first) |
npm run lint |
Run ESLint across the project |
npm run format |
Format all files with Prettier |
npm run format:check |
Check formatting without modifying files |
npm run db:check |
Verify MongoDB connectivity and list collections |
src/
├── app/
│ ├── page.tsx # Main calendar page (client component)
│ ├── layout.tsx # Root layout with styled-components registry
│ ├── error.tsx # Global error boundary
│ ├── loading.tsx # Global loading state
│ ├── not-found.tsx # 404 page
│ ├── globals.css # Global CSS reset
│ └── api/
│ └── tasks/
│ ├── route.ts # GET (list), POST (create) tasks
│ ├── [id]/route.ts # GET, PUT, DELETE single task
│ └── reorder/route.ts # PATCH reorder tasks within a day
├── core/
│ └── calendar-layout.ts # Pure calendar grid computation logic
├── hooks/
│ ├── use-tasks.ts # Task CRUD state, holiday fetching, optimistic updates
│ └── use-calendar-layout.ts # Calendar grid memoization hook
├── lib/
│ ├── mongodb.ts # Mongoose connection with global caching
│ ├── task-model.ts # Mongoose Task schema and model
│ └── registry.tsx # styled-components SSR registry (Next.js App Router)
└── styles/
├── theme.ts # Design tokens (colors, spacing, radii, shadows)
├── animations.ts # Keyframe animations
├── GlobalStyles.ts # Global styled-components styles
├── CalendarStyles.ts # All calendar UI component styles
├── ThemeProvider.tsx # Wraps app with styled-components ThemeProvider
└── ... # Other page-specific style files
scripts/
└── check-mongodb.ts # MongoDB connectivity diagnostic script
postman/
└── calendar-api.json # Postman collection for the REST API
The application exposes a REST API under /api/tasks.
Returns all tasks sorted by date and order.
Creates a new task.
Body:
{
"title": "Team meeting",
"description": "Weekly sync",
"day": 15,
"month": 6,
"year": 2025
}Updates a task by its MongoDB _id.
Deletes a task by its MongoDB _id.
Reorders tasks within a specific day.
Body:
{
"day": 15,
"month": 6,
"year": 2025,
"taskIds": ["<id1>", "<id2>", "<id3>"]
}Import the ready-made Postman collection to explore the API interactively.