📚 Ebook Landing Page
This is small practice project, landing page for ebook sales built with SvelteKit, featuring Stripe payment integration and email notifications via SendGrid.
✨ Features
- 💳 Stripe Integration - Secure payment processing
- 📧 Email Notifications - Automated purchase confirmations via SendGrid
🛠️ Tech Stack
- Framework: SvelteKit (v5)
- Language: TypeScript
- Styling: CSS
- Payment: Stripe
- Email: SendGrid
- Build Tool: Vite
- Linting: ESLint + Prettier
- Deploy: Vercel
📋 Prerequisites
Before you begin, ensure you have the following installed:
- Node.js (v24.7.0 or higher)
- npm, pnpm, or yarn package manager
You'll also need:
🚀 Getting Started
1. Clone the repository
git clone https://github.com/KimChanaDev/ebook-landing-svelte.git
cd ebook-landing-svelte
2. Install dependencies
npm install
# or
pnpm install
# or
yarn install
3. Set up environment variables
Create a .env file in the root directory and add your API keys:
PUBLIC_FRONTEND_URL=http://localhost:5173
# SendGrid
SEND_EMAIL_FROM=your_verified_sender_email
SENDGRID_API_KEY=SG.xxx(your_sendgrid_api_key)
# Stripe
PRICE_ID=price_xxx(your_price_id)
PUBLIC_STRIPE_KEY=pk_test_xxx(your_stripe_publishable_key)
STRIPE_API_KEY=sk_test_xxx(your_stripe_secret_key)
STRIPE_WEBHOOK_SINGING_SECRET=whsec_xxx(your_stribe_webhook_singing_secret)
4. Run the development server
npm run dev
The application will be available at http://localhost:5173
🎨 Components
Main Components
- HeroSection - Landing page hero with CTA
- AuthorSection - Author bio and credentials
- ChapterPreview - Preview of ebook chapters
- FaqSection - Frequently asked questions
- FaqItem - Individual FAQ accordion item
- Button - Reusable button component
💳 Payment Flow
- User clicks buy button
- Request sent to
/api/checkout endpoint
- Stripe Checkout Session created
- User redirected to Stripe payment page
- After successful payment, redirected to
/checkout/success
- If failed or canceled, redirected to
/checkout/failure
- Purchase confirmation email sent via SendGrid
- User receives ebook download link
🚀 Deploy to Vercel
- Push the project to github
- Login vercel with github account
- Deploy with environment variables
- Edit fronend url env with domain name from vercel
- Redeploy