A professional equipment tracking application built with Next.js, Tailwind CSS, and MySQL. Monitor equipment status, activities, and operational events with a modern, responsive interface and robust database storage.
- Equipment Log Entries: Create detailed equipment logs with UTC datetime, equipment type, status, and notes
- Equipment Tracking: Visual equipment selection with icons and color-coded indicators
- Status Management: Pre-defined status options with custom status support
- UTC Time Support: All timestamps are stored and displayed in UTC
- Database Storage: MySQL database for persistent data storage
- Review Log Page: Date-based log review with table view
- Dark/Light Mode: Toggle between dark and light themes
- Responsive Design: Works seamlessly on desktop, tablet, and mobile devices
- Professional UI: Clean, modern interface with smooth animations and transitions
- 🏢 Base: Base station equipment
- 🤖 AUV: Autonomous Underwater Vehicle
- 🚤 USV: Unmanned Surface Vehicle
- 🖥️ C2: Command and Control systems
- 🔧 Other: Other equipment types
- Started: Equipment has been started
- Launched: Equipment has been launched
- Out of water: Equipment is out of water
- Arrived on site: Equipment has arrived at the site
- Left port: Equipment has left the port
- Beginning of capture: Beginning of data capture
- End of capture: End of data capture
- Communication problem: Communication issues
- Mechanical problem: Mechanical issues
- Code problem: Software/code issues
- Node.js 18+
- MySQL 8.0+ or MariaDB 10.5+
- npm or yarn
git clone <repository-url>
cd daily
npm install- Create a
.env.localfile in the project root:
# Database Configuration
DB_HOST=localhost
DB_PORT=3306
DB_USER=root
DB_PASSWORD=your_mysql_password
DB_NAME=cosma_daily_log- Run the database setup script:
npm run setup-dbThis will automatically:
- Create the database
- Create all necessary tables
- Insert sample data
- Test the connection
- Create the database manually:
CREATE DATABASE cosma_daily_log;- Import the schema:
mysql -u root -p cosma_daily_log < database/schema.sqlnpm run dev- Open http://localhost:3000 in your browser.
The application uses a MySQL database with the following structure:
log_entries: Main log entries with datetime, equipment, notes, and timestamplog_status: Status entries linked to log entries (many-to-many relationship)
- UTC DateTime Storage: All timestamps stored in UTC format
- Equipment Enum: Restricted equipment types for data integrity
- Indexed Queries: Optimized for date-based queries
- Cascade Deletes: Automatic cleanup of related status entries
- Sample Data: Pre-loaded with example entries for testing
- Click the "New Entry" button in the header
- Select the date and time in UTC
- Choose the equipment type from the available options
- Add status by clicking on the status buttons or typing custom status
- Write optional notes about the equipment status or activities
- Click "Save Entry" to save your log
- Click "Review Log" button in the header
- Select a date using the date picker
- View all entries for that date in a table format
- Use "Back to Log" to return to the main page
- View all your entries in chronological order
- Delete entries using the delete button on each entry
- Toggle between dark and light mode using the theme button
The application provides RESTful API endpoints:
GET /api/logs- Get all log entriesPOST /api/logs- Create new log entryGET /api/logs/[id]- Get specific log entryDELETE /api/logs/[id]- Delete log entryGET /api/logs/date/[date]- Get logs by date
- Framework: Next.js 15 with App Router
- Styling: Tailwind CSS 4
- Language: TypeScript
- Database: MySQL 8.0+ with mysql2 driver
- Icons: Heroicons (SVG)
- Font: Inter (Google Fonts)
daily/
├── app/
│ ├── api/ # API routes
│ │ ├── logs/ # Log endpoints
│ │ └── logs/date/ # Date-based queries
│ ├── components/ # React components
│ │ ├── Header.tsx # Application header
│ │ ├── DailyLogEntry.tsx # Form for creating entries
│ │ └── LogList.tsx # Display list of entries
│ ├── review/ # Review log page
│ ├── globals.css # Global styles
│ ├── layout.tsx # Root layout
│ └── page.tsx # Main application page
├── database/
│ └── schema.sql # MySQL database schema
├── lib/
│ └── database.ts # Database configuration
├── scripts/
│ └── setup-database.js # Database setup script
├── public/ # Static assets
├── package.json # Dependencies and scripts
└── README.md # This file
Edit the equipmentOptions array in app/components/DailyLogEntry.tsx:
const equipmentOptions = [
{ value: 'base', label: '🏢 Base', color: 'bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200' },
// Add your custom equipment types here
];Update the activityOptions array in app/components/DailyLogEntry.tsx:
const activityOptions = [
'Started', 'Launched', 'Out of water', 'Arrived on site', 'Left port',
'Beginning of capture', 'End of capture', 'Communication problem', 'Mechanical problem', 'Code problem',
'Your New Status' // Add your custom status options here
];Modify the database settings in lib/database.ts or use environment variables:
DB_HOST=your_mysql_host
DB_PORT=3306
DB_USER=your_mysql_user
DB_PASSWORD=your_mysql_password
DB_NAME=cosma_daily_log-
Connection Refused: Ensure MySQL is running
# Ubuntu/Debian sudo systemctl start mysql # macOS brew services start mysql # Windows net start mysql
-
Access Denied: Check user permissions
GRANT ALL PRIVILEGES ON cosma_daily_log.* TO 'your_user'@'localhost'; FLUSH PRIVILEGES;
-
Database Not Found: Run the setup script
npm run setup-db
-
Port Already in Use: Change the port
npm run dev -- -p 3001
-
Build Errors: Clear cache and reinstall
rm -rf node_modules .next npm install
- Push your code to GitHub
- Connect your repository to Vercel
- Add environment variables in Vercel dashboard
- Deploy automatically
The application can be deployed to any platform that supports Next.js:
- Netlify
- Railway
- DigitalOcean App Platform
- AWS Amplify
Note: For production deployment, ensure your MySQL database is accessible from your hosting platform.
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is open source and available under the MIT License.
If you encounter any issues or have questions, please open an issue on GitHub.
Built with ❤️ using Next.js, Tailwind CSS, and MySQL