A full-stack application implementing Notion table view UI with advanced filtering capabilities, built with React, TypeScript, Node.js, and Docker for easy deployment.
Prerequisites:
- Docker and Docker Compose
- Notion API key and Database ID
Setup Steps:
- Clone and setup environment:
git clone <repository-url>
cd notion-table-view-filters
cp server/.env.example server/.env- Add your Notion credentials to
server/.env:
NOTION_SECRET=your_notion_integration_token_here
NOTION_DATABASE_ID=your_notion_database_id_here- Start the application:
make dev
# Or: docker-compose up --build- Access the app:
- Frontend: http://localhost:3000
- Backend API: http://localhost:3001
# Build and start all services
make dev
# Stop services
make down
# View logs
make logs
# Clean up everything
make clean
# Run tests
make test- Responsive table display with modern design
- Column sorting functionality
- Drag-and-drop column rearrangement
- Column resizing for optimal viewing
- Loading states and error handling
- Single Filters: Simple filter conditions for individual properties
- Compound Filters: Advanced filtering with logical operators
- AND/OR Operations: Combine multiple filter conditions
- NOT Operations: Negate filter conditions with validation
- Nested Groups: Create complex filter hierarchies (configurable depth)
- Checkbox (is, is not)
- Date (equals, before, after, between, is empty, is not empty)
- Number (=, β , >, <, β₯, β€, is empty, is not empty)
- Text/Rich Text (is, is not, contains, does not contain, starts with, ends with, is empty, is not empty)
- Select/Multi-select (contains, does not contain, is empty, is not empty)
- Status (is, is not)
- Direct Negation:
NOT (property = "value")βproperty != "value" - Complex Logic:
NOT (A AND B)β(NOT A) OR (NOT B) - Validation System: Real-time error detection for unsupported operators
- User-friendly Messages: Clear error descriptions
- Real-time validation with error messages
- Smart button disabling based on validation state
- Required field validation for all filter inputs
- React Hook Form integration
- React 19 with TypeScript
- Vite for fast development and building
- Tailwind CSS for utility-first styling
- React Hook Form for form state management
- React DnD Kit for drag-and-drop functionality
- React Testing Library for component testing
- Node.js with TypeScript
- Express.js REST API
- @notionhq/client for Notion API integration
- CORS enabled for frontend communication
- Docker for containerization
- Docker Compose for multi-service orchestration
- Jest for testing
- ESLint for code linting
- Make for command shortcuts
βββ src/ # Frontend React app
β βββ components/ # React components
β β βββ filters/ # Filter system components
β β βββ ... # Other UI components
β βββ types/ # TypeScript type definitions
β βββ utils/ # Utility functions
β βββ App.tsx # Main app component
βββ server/ # Backend Express server
β βββ src/
β β βββ index.ts # Express server entry point
β β βββ types/ # Backend type definitions
β βββ Dockerfile # Backend Docker configuration
β βββ .env.example # Environment variables template
β βββ package.json # Backend dependencies
βββ docker-compose.yml # Docker Compose configuration
βββ Dockerfile # Frontend Docker configuration
βββ Makefile # Command shortcuts
βββ README.md # This file
Create server/.env based on server/.env.example:
# Required: Get from https://www.notion.so/my-integrations
NOTION_SECRET=your_notion_integration_token
NOTION_DATABASE_ID=your_notion_database_id
# Optional
PORT=3001
HOST=0.0.0.0
NODE_ENV=production-
Create Integration:
- Go to https://www.notion.so/my-integrations
- Click "New integration"
- Give it a name and select your workspace
- Copy the "Internal Integration Token"
-
Share Database:
- Open your Notion database
- Click "..." β "Connections"
- Add your integration
-
Get Database ID:
- Open your Notion database
- Copy the ID from the URL (the part after
notion.so/and before?v=)
# Frontend tests
npm test
# Backend tests (if available)
cd server && npm test
# Test with Docker
make test- Unit Tests: Core utility functions for NOT operator validation
- Component Tests: Filter components with React Testing Library
- Integration Tests: Form validation and user interactions
# Production deployment
make deploy
# Or manually:
docker-compose -f docker-compose.yml up --build -d- Vercel:
vercel --prod - Netlify: Drag
distfolder to netlify.com/drop - GitHub Pages:
npm run deploy
- Railway:
railway up - Render: Connect GitHub repo
- Heroku: Git push to Heroku
- Handles filters with more than 2 nesting levels
- Converts deeply nested structures into manageable forms
- Configurable depth (default: 2 levels)
- Splits complex filters into multiple simpler groups
- Prevents Notion API limit violations
- Chunked processing (default: 10 filters per group)
- Combines flattening and splitting based on complexity
- Smart algorithms for optimal processing
- Configurable options for customization
- Container health checks for reliability
- Non-root Docker users for security
- Optimized Docker layers for faster builds
- CORS configuration for seamless frontend-backend communication
GET /structure- Get database structure and propertiesPOST /query- Query database with filters and sortingOPTIONS /- CORS preflight handling
// Get database structure
GET http://localhost:3001/structure
// Query with filters
POST http://localhost:3001/query
{
"filter": {
"and": [
{
"property": "Status",
"select": {
"equals": "Done"
}
}
]
},
"sorts": [
{
"property": "Created",
"direction": "descending"
}
],
"page_size": 50
}-
"Must define NOTION_SECRET and NOTION_DATABASE_ID"
- Ensure you created
server/.envfromserver/.env.example - Check that your Notion integration has access to the database
- Ensure you created
-
Frontend can't reach backend
- Ensure both containers are running:
docker-compose ps - Check logs:
make logs
- Ensure both containers are running:
-
Build errors
- Clean and rebuild:
make clean && make dev - Check Node.js version compatibility
- Clean and rebuild:
# Check container status
docker-compose ps
# View logs
docker-compose logs [service-name]
# Restart services
docker-compose restart
# Clean everything
make clean- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
ISC
- Full Docker Integration: Complete containerization with health checks and security best practices
- Advanced NOT Operator: Complex negation logic with comprehensive validation
- Filter Optimization: Automatic flattening and splitting for large queries
- Type Safety: Full TypeScript coverage across frontend and backend
- Testing: Comprehensive test suite with Jest and React Testing Library
- Production Ready: Environment variable management, error handling, and deployment configurations
- Used React Hook Form for superior form state management
- Implemented custom filter flattening to handle Notion API limitations
- Added Makefile for simplified Docker operations
- Structured monorepo-style with separate frontend and backend
- Implemented non-root Docker users for security
- Docker layer optimization for faster builds
- Filter chunking to prevent API timeouts
- Lazy loading and code splitting opportunities
- Health checks for service reliability
This application demonstrates advanced React development, API integration, and production deployment practices.