Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ricsmo/directories

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Notary Directory

A modern, full-featured notary directory platform built with Next.js 15, featuring tiered membership, advanced search capabilities, and comprehensive business tools for notary professionals.

🚀 Features

Core Features

  • Advanced Search & Filtering: Location-based search with ZIP code, city, and service type filters
  • Interactive Google Maps: Cluster markers, location visualization, and mobile-friendly interface
  • Tiered Membership System: FREE, PRO, and PREMIUM plans with progressive feature unlocking
  • Public Profile Pages: SEO-optimized profiles with custom URLs for Premium members
  • Mobile-Responsive Design: Optimized for all screen sizes and devices

Membership Tiers

🆓 FREE

  • Basic profile listing
  • 1 profile photo
  • 5 service areas
  • Standard search placement
  • Email support

💼 PRO ($19/month)

  • Featured listing placement
  • 5 profile photos
  • 15 service areas
  • Sample document uploads
  • Social media links
  • Advanced analytics
  • Priority support
  • Review management

⭐ PREMIUM ($29/month)

  • Everything in PRO plus:
  • Custom branded URLs (yourname.notarydirectory.com)
  • QR code profile sharing
  • Unlimited photos and documents
  • Unlimited service areas
  • API access
  • Dedicated support
  • Custom branding options

Business Features

  • Stripe Integration: Secure payment processing and subscription management
  • Email Notifications: Automated communications via Resend
  • SEO Optimization: Structured data, meta tags, and search engine friendly URLs
  • Analytics Dashboard: Comprehensive business insights for Pro/Premium members
  • Lead Generation: Contact forms and inquiry management

🛠️ Tech Stack

Frontend

  • Next.js 15: React framework with App Router
  • TypeScript: Type safety and developer experience
  • Tailwind CSS 4: Modern utility-first styling
  • Headless UI: Accessible component primitives

Backend & Database

  • Cloudflare Workers: Edge computing platform
  • Cloudflare D1: SQLite database at the edge
  • Cloudflare R2: Object storage for files and images
  • Next.js API Routes: Server-side functionality

Third-Party Services

  • Google Maps API: Location services and mapping
  • Stripe: Payment processing and subscriptions
  • Resend: Transactional email service
  • Cloudflare: CDN, security, and hosting

📋 Prerequisites

Before setting up the project, you'll need accounts and API keys for:

  1. Cloudflare Account (Free tier available)
  2. Google Cloud Platform (Google Maps API)
  3. Stripe Account (Test mode available)
  4. Resend Account (Free tier available)

⚡ Quick Start

1. Clone and Install

git clone https://github.com/your-username/notary-directory.git
cd notary-directory
npm install

2. Environment Setup

Copy the example environment file and configure your API keys:

cp .env.example .env.local

Edit .env.local with your API keys (see Configuration section below).

3. Development Server

npm run dev

The application will be available at http://localhost:3000.

4. Build for Production

npm run build
npm run pages:build  # For Cloudflare Pages deployment

🔧 Configuration

Environment Variables

Create a .env.local file with the following variables:

# Database
DATABASE_URL="your-d1-database-url"

# Authentication
AUTH_SECRET="your-jwt-secret-key-change-in-production"

# Email Service (Resend)
RESEND_API_KEY="your-resend-api-key"

# Google Maps
NEXT_PUBLIC_GOOGLE_MAPS_API_KEY="your-google-maps-api-key"

# Stripe (use test keys for development)
STRIPE_SECRET_KEY="sk_test_..."
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY="pk_test_..."
STRIPE_WEBHOOK_SECRET="whsec_..."

# App Configuration
NEXT_PUBLIC_BASE_URL="http://localhost:3000"  # Change for production

🌐 Service Configuration

Cloudflare Setup

1. Create Cloudflare Account

  • Sign up at cloudflare.com
  • Add your domain to Cloudflare (optional for development)

2. D1 Database Setup

# Install Wrangler CLI
npm install -g wrangler

# Login to Cloudflare
wrangler login

# Create D1 database
wrangler d1 create notary-directory

# Run database migrations
wrangler d1 execute notary-directory --file=./database/schema.sql

3. R2 Storage Setup

# Create R2 bucket for file uploads
wrangler r2 bucket create notary-directory-uploads

4. Pages Deployment

# Deploy to Cloudflare Pages
npm run deploy

Google Maps API Setup

1. Google Cloud Console

2. Enable APIs

Enable the following APIs:

  • Maps JavaScript API
  • Places API
  • Geocoding API

3. Create API Key

  • Go to "Credentials" → "Create Credentials" → "API Key"
  • Restrict the API key to your domain for security
  • Set usage quotas to prevent unexpected charges

4. API Key Restrictions (Production)

HTTP referrers:
- https://yourdomain.com/*
- https://*.yourdomain.com/*

API restrictions:
- Maps JavaScript API
- Places API
- Geocoding API

Stripe Configuration

1. Stripe Dashboard

  • Sign up at stripe.com
  • Complete account setup for live payments

2. Products and Pricing

Create the following products in Stripe Dashboard:

PRO Membership

  • Monthly: $19.00
  • Yearly: $190.00 (save $38/year)

PREMIUM Membership

  • Monthly: $29.00
  • Yearly: $290.00 (save $58/year)

3. Webhooks

Set up webhook endpoints:

Endpoint URL: https://yourdomain.com/api/webhooks/stripe
Events to send:
- customer.subscription.created
- customer.subscription.updated
- customer.subscription.deleted
- invoice.payment_succeeded
- invoice.payment_failed

4. Test Mode

Use Stripe test cards for development:

Success: 4242 4242 4242 4242
Decline: 4000 0000 0000 0002

Resend Email Setup

1. Resend Account

  • Sign up at resend.com
  • Verify your sending domain

2. Domain Configuration

Add these DNS records to your domain:

CNAME: em.yourdomain.com → track.resend.dev
CNAME: feedback-smtp.yourdomain.com → feedback-smtp.resend.dev
TXT: yourdomain.com → "v=spf1 include:_spf.resend.dev ~all"

3. API Key

  • Generate API key in Resend dashboard
  • Add to .env.local as RESEND_API_KEY

🗄️ Database Schema

The application uses Cloudflare D1 (SQLite) with the following main tables:

  • users - User accounts and authentication
  • notaries - Notary profiles and business information
  • memberships - Subscription and billing information
  • searches - Saved search preferences
  • inquiries - Customer inquiries and leads

Run migrations with:

wrangler d1 execute notary-directory --file=./database/schema.sql

📱 API Documentation

Authentication Endpoints

POST /api/auth/signin     - User login
POST /api/auth/signup     - User registration
POST /api/auth/signout    - User logout

Search Endpoints

GET  /api/search/location  - Location-based notary search
GET  /api/search/suggest   - Location autocomplete suggestions

Profile Endpoints

GET    /api/profile/notary       - Get notary profile
PUT    /api/profile/notary       - Update notary profile
POST   /api/profile/notary/photo - Upload profile photo

Subscription Endpoints

POST /api/subscriptions/create   - Create subscription
POST /api/subscriptions/cancel   - Cancel subscription
GET  /api/subscriptions/status   - Get subscription status

Webhook Endpoints

POST /api/webhooks/stripe  - Stripe webhook handler

🚀 Deployment

Cloudflare Pages Deployment

  1. Build the application:
npm run build
npm run pages:build
  1. Deploy via Wrangler:
wrangler pages deploy .next --project-name=notary-directory
  1. Set up custom domain:
  • Add your domain in Cloudflare Pages dashboard
  • Configure DNS to point to Cloudflare

Environment Variables (Production)

Set these in Cloudflare Pages dashboard:

  • All variables from .env.local
  • Update NEXT_PUBLIC_BASE_URL to your production domain
  • Use live Stripe keys instead of test keys

🔒 Security Considerations

API Keys

  • Never commit API keys to version control
  • Use environment variables for all sensitive data
  • Rotate API keys regularly

Stripe Security

  • Use webhook signatures to verify Stripe events
  • Implement proper error handling for payment failures
  • Use HTTPS in production

Database Security

  • Implement proper authentication checks
  • Sanitize all user inputs
  • Use prepared statements to prevent SQL injection

🧪 Testing

Run Tests

npm run test          # Unit tests
npm run test:e2e      # End-to-end tests
npm run test:coverage # Coverage report

Test Accounts

Create test accounts for each membership tier:

📈 Monitoring and Analytics

Cloudflare Analytics

  • Monitor page views and performance
  • Track API usage and errors
  • Set up alerts for downtime

Stripe Dashboard

  • Monitor subscription metrics
  • Track revenue and churn
  • Analyze payment failures

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Submit a pull request

Development Guidelines

  • Follow TypeScript best practices
  • Use Tailwind CSS for styling
  • Write tests for new features
  • Update documentation

📄 License

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

🆘 Support

Documentation

Community

  • GitHub Issues for bug reports
  • GitHub Discussions for questions
  • Discord community for real-time help

🎯 Roadmap

Upcoming Features

  • Mobile app (React Native)
  • Advanced analytics dashboard
  • Multi-language support
  • White-label solutions
  • Integration marketplace
  • Advanced SEO tools

Version History

  • v1.0.0 - Initial release with core functionality
  • v1.1.0 - Google Maps integration and search improvements
  • v1.2.0 - Enhanced profile system and tier-based features

Built with ❤️ using Next.js, Cloudflare, and modern web technologies.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages