Skip to content

Music · SaaS · E-commerce · Case study

Cuts Like A Knife: A music licensing platform with AI search and audio similarity

Music licensing platform case study: NestJS GraphQL API, Next.js admin, FastAPI ML search with OpenL3 embeddings and OpenAI, Stripe licensing tiers.

Cuts Like A Knife product interface
Client
Cuts Like A Knife is a professional music licensing and distribution platform for creators and subscribers.
Team
2 full-stack engineers, 1 designer
Timeline
12 weeks to launch
Services
Web development, AI and data, Cloud and DevOps
3
Independently deployed services
60+
GraphQL queries and mutations
15+
Database entities
4
Roles in the access model

In short

Cuts Like A Knife needed a platform where music creators upload and monetise tracks and subscribers find the right music through natural-language search and audio similarity. We built three services: a NestJS GraphQL backend on PostgreSQL, a Next.js 14 admin panel with waveform playback, and a FastAPI machine-learning service using OpenL3 embeddings, FAISS and Amazon OpenSearch. Stripe handles tiered subscriptions with permission-based licensing and one-time purchases.

The challenge

Where they started.

  • Let creators upload large audio catalogues with metadata extracted automatically rather than typed by hand
  • Give subscribers search that understands intent, such as mood and tempo, and finds tracks that sound alike
  • Gate rights precisely: broadcast, stems, loops, commercial use, monetised YouTube, podcasts and indie films are different licences
  • Run subscriptions, one-time purchases, proration, refunds and failed-payment retries through one billing system
  • Stream and download audio securely without exposing files
What we did

The approach.

  • Designed three independently deployable services: a NestJS 10 GraphQL API, a Next.js 14 admin panel and a Python FastAPI machine-learning service
  • Built direct-to-S3 uploads through presigned URLs with FFmpeg processing and automatic metadata extraction for title, mood, tempo, BPM, genre, key and duration
  • Implemented natural-language search with OpenAI and LangChain, and audio similarity with OpenL3 embeddings indexed in FAISS and Amazon OpenSearch
  • Added a background processor that watches S3 for new uploads and generates embeddings automatically, plus collaborative filtering for recommendations
  • Modelled licences as permissions with JSONB feature flags attached to Stripe subscription plans, alongside one-time track purchases
  • Integrated the full Stripe webhook lifecycle: subscriptions, payment intents, invoices, refunds and charge events, with proration and retry tracking
  • Secured streaming and downloads with CloudFront signed URLs
Deliverables

What shipped.

  • Unified GraphQL API with 60+ queries and mutations across 12 resolver modules
  • Admin dashboard with user, role, subscription and catalogue management and bulk CSV import and export
  • ML service for search, embeddings and recommendations, deployed with its own pipeline
  • Track upload pipeline with FFmpeg processing, previews and waveform visualisation
  • Subscription and purchase system with cart, orders, purchase history and download tracking
  • Playlists, projects with broadcast support, favourites, reviews and ratings
  • RBAC across Super Admin, Admin, Sub-User and User with Argon2 hashing
  • Docker images on AWS Elastic Beanstalk with CodeDeploy pipelines for develop and main
In detail

How the engagement ran.

Context

A music licensing business lives or dies on discovery. Subscribers arrive with a brief in their head, such as an upbeat track for a podcast intro at a certain tempo, and they leave if search returns noise. Creators, meanwhile, will not tag hundreds of tracks by hand. Cuts Like A Knife wanted a platform that solved both sides and enforced licensing terms precisely.

We built the product as a small set of services, each doing one job well, sharing S3 storage and a search index rather than a codebase.

Two flows define the product. The upload flow takes a creator's file from the browser to S3, extracts its metadata, generates a preview and produces an embedding for search, with no manual tagging. The subscription flow takes a subscriber from plan selection through Stripe Elements to a set of licence permissions that the API checks on every download. Everything else, from playlists to reporting, sits on those two flows.

What we built

  • A track and audio management system with direct-to-S3 upload, FFmpeg processing, automatic metadata extraction and waveform display
  • Natural-language search through OpenAI and LangChain, and audio similarity through OpenL3 embeddings, FAISS and Amazon OpenSearch
  • A background processor that watches S3 and embeds new uploads automatically, with collaborative filtering for recommendations
  • Multi-tier Stripe subscriptions with permission-based licensing, one-time purchases, a shopping cart, proration and refunds
  • Playlists with drag-and-drop ordering, projects with broadcast support, favourites, reviews and ratings
  • An admin dashboard for users, roles, subscriptions, the catalogue, contact submissions and financial reporting
  • Secure streaming and time-limited downloads through CloudFront signed URLs

Architecture and stack

LayerTechnologyWhy
APINestJS 10, Apollo GraphQL 16, TypeORM, PostgreSQLOne typed endpoint for the admin and consumer surfaces; guards for auth, role and payment status
AdminNext.js 14, React 18, Ant Design 5, Tailwind CSS 3, Apollo Client, WaveSurfer.js, Framer MotionServer rendering with rich audio playback and catalogue tooling
ML serviceFastAPI, TensorFlow, OpenL3, LangChain, OpenAI, FAISS, Amazon OpenSearchPython for audio and vector work, scaled and deployed separately
AudioFFmpeg, music-metadata, CloudFront signed URLsConversion, previews, auto-tagging and secure delivery
PaymentsStripe subscriptions, invoices, payment intents, refunds, webhooksThe full billing lifecycle including proration and retry tracking
EmailMandrill, SendGrid, Mailchimp TransactionalTemplate-based transactional workflows
InfrastructureDocker on Node 18 Alpine with FFmpeg, AWS Elastic Beanstalk, CodeDeploy, pnpmEnvironment-specific deployments triggered by branch pushes, migrations on startup
SecurityJWT with Passport, RBAC across 4 roles, Argon2, SSL/TLSStandard controls applied consistently across services

How we worked

The schema came first: 15 or more PostgreSQL entities covering users and roles, tracks with full audio metadata, commerce, subscription plans and permissions, content organisation and engagement, managed through migrations with no auto-sync and SSL in production. The GraphQL layer was built as 12 resolver modules with guard-based middleware, DTO validation, pagination and computed fields such as whether a track is already purchased.

The upload pipeline was designed so the API is never a bottleneck: the browser uploads straight to S3, the backend processes metadata and previews, and the ML service detects the new file and embeds it. Deployment followed the same separation, with CodeDeploy pipelines for the platform and for the model service.

Search results are cached so repeated queries return quickly, and the catalogue supports bulk CSV import and export so the client could migrate an existing library and keep it in sync. The admin panel was built with the same rigour as the consumer side: filtering, role assignment, subscription control, contact-form triage with read status, and transaction summaries for financial reporting.

Scale and complexity

MeasureFigure from the documentation
Services3: GraphQL API, admin panel, ML service
GraphQL operations60+ queries and mutations across 12 resolver modules
Database entities15+ with migration-based schema management
Licence permissionsBroadcast, stems, loops, commercial, monetised YouTube, podcasts, indie films
Roles4: Super Admin, Admin, Sub-User, User
CacheCache Manager with a one-hour default TTL

What this means for your project

Search that understands meaning, not just keywords, is now a product expectation. This platform shows the practical path: embeddings generated in the background, a vector index, and a language model in front of it, all kept out of the request path so the site stays fast.

It also shows rights management done properly. If your product sells access to content under different terms, the permission-flag model here is the one we would reuse.

Outcome

What changed.

  • Every technology and pattern in the platform has been shipped to production, handling real users and real transactions
  • New uploads are embedded and searchable automatically without manual tagging
  • Licensing rights are enforced at the feature level, so subscribers only access what their plan allows
  • Plan changes are prorated automatically and failed payments are tracked with retry logic
FAQ

Questions about this project.

How does audio similarity search work?

Each track is turned into an OpenL3 embedding by a Python service running TensorFlow. Embeddings are indexed in FAISS and Amazon OpenSearch, so a query track or a text description mapped through OpenAI can be matched to the nearest tracks in the catalogue. A background processor keeps the index current as uploads arrive.

How are different licence types enforced?

Licences are modelled as permissions with feature flags stored as JSONB and tied to subscription plans. Guards on the GraphQL resolvers check the flags for broadcast, stems, loops, commercial rights, monetised YouTube, podcasts and indie film use before serving a download.

Why split the machine-learning work into its own service?

Python has the audio and ML libraries, the workloads scale differently from the API, and a separate CodeDeploy pipeline lets the model service change without redeploying the platform. The services share S3 and the search index rather than code.