A comprehensive recording management system with API endpoints and a web dashboard for managing and analyzing audio recordings from mobile applications.
- RESTful API for recording management (CRUD operations)
- Web Dashboard for visualizing recordings and analytics
- Daily, Weekly, and Monthly Analytics with detailed statistics
- User-based Recording Management
- Real-time Data Visualization with charts and graphs
- Responsive Modern UI built with React and TailwindCSS
anava-api/
├── supabase/
│ ├── functions/
│ │ └── anava/
│ │ ├── index.ts # Main API endpoints
│ │ └── Recording.kt # Kotlin data model (reference)
│ └── migrations/
│ └── 001_create_recordings_table.sql # Database schema
├── anava-web/ # Netlify React app
│ ├── src/
│ │ ├── components/
│ │ │ ├── RecordingsList.tsx
│ │ │ ├── AnalyticsDashboard.tsx
│ │ │ └── ui/ # Shadcn/ui components
│ │ ├── lib/
│ │ │ ├── api.ts # API client
│ │ │ └── utils.ts
│ │ ├── types/
│ │ │ └── index.ts # TypeScript types
│ │ ├── App.tsx
│ │ └── main.tsx
│ ├── netlify.toml # Netlify configuration
│ └── package.json
└── CHANGELOG.md
- Node.js 18+
- Supabase CLI
- npm or yarn
-
Install Supabase CLI:
npm install -g supabase
-
Initialize Supabase (if not already done):
supabase init
-
Start Supabase locally:
supabase start
-
Run database migrations:
supabase db push
-
Deploy the function:
supabase functions deploy anava
-
Navigate to the web app directory:
cd anava-web -
Install dependencies:
npm install
-
Configure environment variables:
cp .env.example .env
Edit
.envand set your Supabase URL:VITE_API_URL=http://localhost:54321/functions/v1 # For local development # or VITE_API_URL=https://your-project.supabase.co/functions/v1 # For production -
Run the development server:
npm run dev
- Local:
http://localhost:54321/functions/v1/anava - Production:
https://your-project.supabase.co/functions/v1/anava
GET /healthPOST /recordings
Content-Type: application/json
{
"userId": "user1",
"date": "2024-01-15",
"slotId": 1,
"timestamp": 1705334400000,
"amplitudesJson": "{}",
"activityType": "meditation",
"activityTimestamp": 1705335000000,
"longitude": 40.7128,
"latitude": -74.0060,
"thumbnail": "base64_encoded_image"
}GET /recordings?userId=user1&date=2024-01-15&limit=100&offset=0GET /recordings/:idGET /recordings/user/:userId?date=2024-01-15&limit=100GET /recordings/analytics/:userIdResponse includes:
- Daily stats (today)
- Weekly stats (last 7 days with daily breakdown)
- Monthly stats (last 30 days)
PUT /recordings/:id
Content-Type: application/json
{
"activityType": "updated_meditation"
}DELETE /recordings/:id-
Configure Supabase project:
supabase link --project-ref your-project-ref
-
Deploy function:
supabase functions deploy anava
-
Run migrations:
supabase db push
-
Build the app:
cd anava-web npm run build -
Deploy using Netlify CLI:
npm install -g netlify-cli netlify deploy --prod --dir=dist
Or connect your GitHub repository to Netlify for automatic deployments.
-
Set environment variables in Netlify:
- Go to Site Settings > Environment Variables
- Add:
VITE_API_URL=https://your-project.supabase.co/functions/v1
The recordings table structure:
| Column | Type | Description |
|---|---|---|
| id | SERIAL | Primary key |
| userId | VARCHAR(255) | User identifier |
| date | DATE | Recording date |
| slotId | INTEGER | Time slot identifier |
| timestamp | BIGINT | Start timestamp |
| amplitudesJson | TEXT | Audio amplitude data (JSON) |
| activityType | VARCHAR(100) | Type of activity |
| activityTimestamp | BIGINT | End timestamp |
| longitude | DECIMAL(10,7) | GPS longitude (optional) |
| latitude | DECIMAL(10,7) | GPS latitude (optional) |
| thumbnail | TEXT | Base64 encoded thumbnail (optional) |
| duration | INTEGER | Duration in seconds (calculated) |
| percentage | INTEGER | Progress percentage (calculated) |
| created_at | TIMESTAMP | Creation timestamp |
| updated_at | TIMESTAMP | Last update timestamp |
- Row Level Security (RLS) is enabled on the recordings table
- Users can only access their own recordings
- API endpoints validate user permissions
- CORS is configured for the web application
cd anava-web
npm run testnpm run lintnpm run type-checkThe API is designed to accept data from mobile apps. The data structure matches the Kotlin Recording data class:
data class Recording(
val id: Int,
val date: LocalDate,
val slotId: Int,
val timestamp: Long,
val amplitudesJson: String,
val activityType: String,
val activityTimestamp: Long,
val longitude: Double?,
val latitude: Double?,
val thumbnail: ByteArray?
)Mobile apps should:
- Convert the Recording object to JSON
- Send POST request to
/anava/recordingsendpoint - Include user authentication token in headers
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
This project is licensed under the MIT License.
For issues and questions, please open an issue on GitHub or contact the development team.