A simple web application to help parents track their child's potty training progress. Users can log whether their child had an accident ("dirty pants") or successfully used the potty.
- Simple User Registration: No passwords required, just enter a username
- Event Logging: Two main events - "Dirty Pants" and "Potty"
- Visual & Audio Feedback: Cartoon icons, pictures, and sounds when buttons are clicked
- Statistics Dashboard: 14-day history of events with counts
- Responsive Design: Works on mobile and desktop
- Child-Friendly Interface: Bright colors and intuitive design
- Framework: Next.js with TypeScript
- Styling: Tailwind CSS
- Icons: Lucide React
- State Management: React hooks
- Framework: Node.js with Express
- Database: PostgreSQL
- Security: Helmet, CORS, Rate limiting
potty-buddy/
βββ frontend/ # Next.js frontend application
β βββ components/ # React components
β βββ lib/ # API client and utilities
β βββ pages/ # Next.js pages
β βββ public/ # Static assets (sounds, images)
β βββ styles/ # Global styles
βββ backend/ # Node.js backend API
β βββ src/
β β βββ config/ # Database configuration
β β βββ routes/ # API routes
β β βββ server.js # Main server file
β βββ package.json
βββ README.md
- Node.js 18+
- PostgreSQL database
- npm or yarn
-
Navigate to backend directory:
cd backend -
Install dependencies:
npm install
-
Set up environment variables: Create a
.envfile in the backend directory:DATABASE_URL=postgresql://username:password@localhost:5432/potty_buddy PORT=3001 NODE_ENV=development FRONTEND_URL=http://localhost:3000
-
Start the development server:
npm run dev
The backend will be available at http://localhost:3001
-
Navigate to frontend directory:
cd frontend -
Install dependencies:
npm install
-
Start the development server:
npm run dev
The frontend will be available at http://localhost:3000
The application uses PostgreSQL with the following schema:
-- Users table
CREATE TABLE users (
id SERIAL PRIMARY KEY,
username VARCHAR(50) UNIQUE NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Events table
CREATE TABLE events (
id SERIAL PRIMARY KEY,
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE,
event_type VARCHAR(20) NOT NULL CHECK (event_type IN ('dirty_pants', 'potty')),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);The tables will be created automatically when the backend starts.
GET /api/users/:username- Check if username existsPOST /api/users- Create new user
POST /api/events- Log new eventGET /api/events/:userId- Get user's events for statistics
-
Create a new Web Service on Render
-
Connect your GitHub repository
-
Configure the service:
- Build Command:
npm install - Start Command:
npm start - Environment Variables:
DATABASE_URL: Your PostgreSQL connection stringNODE_ENV:productionFRONTEND_URL: Your frontend URL
- Build Command:
-
Add PostgreSQL database:
- Create a new PostgreSQL database on Render
- Add the
DATABASE_URLenvironment variable
-
Connect your GitHub repository to Vercel
-
Configure the project:
- Framework Preset: Next.js
- Root Directory:
frontend - Build Command:
npm run build - Output Directory:
.next
-
Add environment variables:
NEXT_PUBLIC_API_URL: Your backend API URL
DATABASE_URL=postgresql://username:password@host:port/database
PORT=3001
NODE_ENV=development
FRONTEND_URL=http://localhost:3000NEXT_PUBLIC_API_URL=http://localhost:3001/api- Simple username-based registration
- No password required
- Username uniqueness validation
- Immediate feedback for existing usernames
- Two main event types: "Dirty Pants" and "Potty"
- Large, colorful buttons with cartoon icons
- Audio feedback when buttons are clicked
- Visual feedback with animations
- Events are logged with exact timestamps
- 14-day history view
- Summary cards showing total counts
- Daily breakdown of events
- Color-coded statistics (green for potty, red for accidents)
- Responsive design for mobile and desktop
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
MIT License - see LICENSE file for details
For support or questions, please open an issue on GitHub.
Note: The sound files in /frontend/public/sounds/ are placeholders. In a production environment, you should replace them with actual MP3 files for better user experience. # potty_buddy_webapp