Skip to content

Feedback Form Builder - A modern, full-stack web application for creating, managing, and analyzing custom feedback forms with real-time analytics and response management. Built with React, Node.js, Express, and MongoDB.

Notifications You must be signed in to change notification settings

anuj308/feedback

Repository files navigation

πŸ“‹ Feedback Form Builder

A modern, full-stack web application for creating, managing, and analyzing custom feedback forms with real-time analytics and response management.

React Node.js MongoDB TailwindCSS

πŸš€ Features

πŸ“ Form Creation & Management

  • Dynamic Form Builder: Create forms with multiple question types (short answer, paragraph, multiple choice, checkboxes, dropdown, file upload)
  • Real-time Form Editor: Live preview and editing capabilities
  • Form Templates: Quick start with pre-built templates
  • Form Settings: Control response collection, confirmation messages, and access permissions

πŸ“Š Analytics & Insights

  • Response Analytics: Real-time visualization of form responses
  • Data Export: Export responses in multiple formats
  • Response Management: View, filter, and manage individual responses
  • Form Performance: Track completion rates and engagement metrics

πŸ” Authentication & Security

  • Secure Authentication: JWT-based authentication with HTTP-only cookies
  • User Management: Registration, login, and profile management
  • Protected Routes: Role-based access control
  • Data Privacy: Secure data handling and storage

🎨 User Experience

  • Responsive Design: Mobile-first approach with TailwindCSS
  • Intuitive Interface: Clean, modern UI with smooth interactions
  • Real-time Updates: Live form preview and instant feedback
  • Loading States: Comprehensive loading and error handling

πŸ—οΈ System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    HTTP/HTTPS     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                 │◄─────────────────►│                 β”‚
β”‚   Frontend      β”‚                   β”‚   Backend       β”‚
β”‚   (React SPA)   β”‚                   β”‚   (Node.js)     β”‚
β”‚                 β”‚                   β”‚                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                                       β”‚
         β”‚                                       β”‚
         β–Ό                                       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Browser       β”‚                   β”‚   MongoDB       β”‚
β”‚   Storage       β”‚                   β”‚   Database      β”‚
β”‚                 β”‚                   β”‚                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Technology Stack

Frontend

  • React 18.2.0 - Modern UI library with hooks
  • React Router DOM - Client-side routing
  • Axios - HTTP client with interceptors
  • TailwindCSS - Utility-first CSS framework
  • Vite - Fast build tool and development server
  • React Hook Form - Efficient form handling

Backend

  • Node.js - JavaScript runtime environment
  • Express.js - Web application framework
  • MongoDB - NoSQL database
  • Mongoose - MongoDB object modeling
  • JWT - JSON Web Tokens for authentication
  • bcrypt - Password hashing
  • Multer - File upload handling
  • Cloudinary - Cloud image storage

Development Tools

  • ESLint - Code linting and formatting
  • Prettier - Code formatting
  • Nodemon - Development server auto-restart
  • CORS - Cross-origin resource sharing

πŸ“ Project Structure

feedback/
β”œβ”€β”€ Backend/                    # Server-side application
β”‚   β”œβ”€β”€ controllers/           # Route controllers
β”‚   β”‚   β”œβ”€β”€ user.controller.js
β”‚   β”‚   β”œβ”€β”€ form.controller.js
β”‚   β”‚   └── store.controller.js
β”‚   β”œβ”€β”€ models/                # Database models
β”‚   β”‚   β”œβ”€β”€ user.model.js
β”‚   β”‚   β”œβ”€β”€ form.model.js
β”‚   β”‚   └── store.model.js
β”‚   β”œβ”€β”€ routes/                # API routes
β”‚   β”‚   β”œβ”€β”€ user.route.js
β”‚   β”‚   β”œβ”€β”€ form.routes.js
β”‚   β”‚   └── store.route.js
β”‚   β”œβ”€β”€ middleware/            # Custom middleware
β”‚   β”‚   β”œβ”€β”€ auth.middleware.js
β”‚   β”‚   └── multer.middleware.js
β”‚   β”œβ”€β”€ utils/                 # Utility functions
β”‚   β”‚   β”œβ”€β”€ ApiError.js
β”‚   β”‚   β”œβ”€β”€ ApiResponse.js
β”‚   β”‚   └── asyncHandler.js
β”‚   β”œβ”€β”€ uploads/               # File upload directory
β”‚   β”œβ”€β”€ .env                   # Environment variables
β”‚   β”œβ”€β”€ app.js                 # Express app configuration
β”‚   β”œβ”€β”€ server.js              # Server entry point
β”‚   └── package.json
β”‚
β”œβ”€β”€ Frontend/                   # Client-side application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/        # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ pages/             # Page components
β”‚   β”‚   β”œβ”€β”€ Context/           # React Context providers
β”‚   β”‚   β”œβ”€β”€ utils/             # Utility functions
β”‚   β”‚   β”‚   └── api.js         # Centralized API management
β”‚   β”‚   β”œβ”€β”€ assets/            # Static assets
β”‚   β”‚   β”œβ”€β”€ App.jsx            # Main application component
β”‚   β”‚   └── main.jsx           # Application entry point
β”‚   β”œβ”€β”€ public/                # Static public files
β”‚   β”œβ”€β”€ .env                   # Environment variables
β”‚   β”œβ”€β”€ index.html             # HTML entry point
β”‚   β”œβ”€β”€ package.json
β”‚   β”œβ”€β”€ tailwind.config.js     # TailwindCSS configuration
β”‚   └── vite.config.js         # Vite configuration
β”‚
└── README.md                   # Project documentation

πŸ› οΈ Installation & Setup

Prerequisites

  • Node.js (v16 or higher)
  • MongoDB (v4.4 or higher)
  • npm or yarn
  • Git

Backend Setup

  1. Clone the repository

    git clone https://github.com/anuj308/feedback.git
    cd feedback/Backend
  2. Install dependencies

    npm install
  3. Environment Configuration Create a .env file in the Backend directory:

    # Database Configuration
    MONGODB_URI=mongodb://localhost:27017/feedback-app
    DB_NAME=feedback
    
    # Server Configuration
    PORT=9000
    
    # CORS Configuration
    CORS_ORIGIN=http://localhost:5173
    
    # JWT Configuration
    ACCESS_TOKEN_SECRET=your-super-secret-jwt-key-here
    ACCESS_TOKEN_EXPIRY=1d
    REFRESH_TOKEN_SECRET=your-refresh-token-secret-here
    REFRESH_TOKEN_EXPIRY=10d
    
    # Cloudinary Configuration (Optional)
    CLOUDINARY_CLOUD_NAME=your-cloud-name
    CLOUDINARY_API_KEY=your-api-key
    CLOUDINARY_API_SECRET=your-api-secret
    
    # Environment
    NODE_ENV=development
  4. Start the backend server

    # Development mode
    npm run dev
    
    # Production mode
    npm start

    The backend server will start on http://localhost:9000

Frontend Setup

  1. Navigate to frontend directory

    cd ../Frontend
  2. Install dependencies

    npm install
  3. Environment Configuration Create a .env file in the Frontend directory:

    # API Configuration
    VITE_API_BASE_URL=/api/v1
    VITE_BACKEND_URL=http://localhost:9000
    
    # Environment
    VITE_NODE_ENV=development
    
    # Debug flags
    VITE_DEBUG_API=true
    VITE_DEBUG_COMPONENTS=false
    
    # App configuration
    VITE_APP_NAME=Feedback Form Builder
    VITE_APP_VERSION=1.0.0
  4. Start the frontend development server

    npm run dev

    The frontend application will start on http://localhost:5173

πŸš€ Usage

Getting Started

  1. Access the application at http://localhost:5173
  2. Create an account or login with existing credentials
  3. Create your first form using the intuitive form builder
  4. Share your form with respondents
  5. Analyze responses using the built-in analytics dashboard

API Endpoints

Authentication

  • POST /api/v1/user/register - User registration
  • POST /api/v1/user/login - User login
  • POST /api/v1/user/logout - User logout
  • GET /api/v1/user/current-user - Get current user

Forms Management

  • POST /api/v1/form/create - Create new form
  • GET /api/v1/form/f/:id - Get form by ID
  • PATCH /api/v1/form/f/:id - Update form
  • DELETE /api/v1/form/f/:id - Delete form
  • GET /api/v1/form/o/:ownerId - Get forms by owner

Response Management

  • POST /api/v1/store - Submit form response
  • GET /api/v1/store/f/:formId - Get responses for form
  • GET /api/v1/form/analytics/:id - Get form analytics

πŸ§ͺ Testing

Running Tests

# Backend tests
cd Backend
npm test

# Frontend tests
cd Frontend
npm test

Manual Testing

  1. Test user registration and login
  2. Create and edit forms with different question types
  3. Submit responses and verify data persistence
  4. Test responsive design on different devices
  5. Verify authentication and authorization flows

πŸ“ API Documentation

Authentication Flow

sequenceDiagram
    participant Client
    participant Server
    participant Database

    Client->>Server: POST /user/login
    Server->>Database: Verify credentials
    Database-->>Server: User data
    Server-->>Client: JWT token (HTTP-only cookie)
    
    Client->>Server: Protected route request
    Server->>Server: Verify JWT token
    Server-->>Client: Protected resource
Loading

Form Creation Flow

sequenceDiagram
    participant User
    participant Frontend
    participant Backend
    participant Database

    User->>Frontend: Create form
    Frontend->>Backend: POST /form/create
    Backend->>Database: Save form
    Database-->>Backend: Form ID
    Backend-->>Frontend: Form created
    Frontend-->>User: Redirect to form editor
Loading

πŸ”§ Configuration

Development Configuration

  • Hot Reload: Enabled for both frontend and backend
  • CORS: Configured for local development
  • Proxy: Vite proxy setup for API calls
  • Environment Variables: Separate configs for dev/prod

Production Configuration

  • Build Optimization: Minified and optimized builds
  • Security Headers: Implemented security best practices
  • Error Handling: Comprehensive error logging
  • Performance: Optimized for production deployment

πŸš€ Deployment

Frontend Deployment (Vercel/Netlify)

# Build for production
npm run build

# Preview production build
npm run preview

Backend Deployment (Heroku/Railway)

# Set environment variables
# Deploy using platform-specific commands

Database Setup (MongoDB Atlas)

  1. Create MongoDB Atlas cluster
  2. Update connection string in environment variables
  3. Configure network access and user permissions

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Code Style

  • Follow ESLint configuration
  • Use Prettier for code formatting
  • Write meaningful commit messages
  • Add tests for new features

πŸ“„ License

This project is licensed under the ISC License - see the LICENSE file for details.

πŸ‘₯ Authors

  • Anuj Kumar Sharma - Initial work - anuj308

πŸ™ Acknowledgments

  • React team for the amazing framework
  • Express.js community for the robust backend framework
  • MongoDB team for the flexible database solution
  • TailwindCSS for the utility-first CSS framework

πŸ“ž Support

For support, email anujkumarsharma2023@gmail.com or create an issue in the GitHub repository.

πŸ”„ Changelog

v1.0.0 (Current)

  • Initial release with core functionality
  • User authentication and authorization
  • Form creation and management
  • Response collection and analytics
  • Responsive design implementation

Made with ❀️ by Anuj Kumar Sharma

About

Feedback Form Builder - A modern, full-stack web application for creating, managing, and analyzing custom feedback forms with real-time analytics and response management. Built with React, Node.js, Express, and MongoDB.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages