Eine geteilte Bibliothek für EPUB und PDF Dateien. User müssen eingeladen werden, jeder kann seine EPUBs und PDFs teilen.
A shared library for EPUB and PDF files with invitation-only access.
- ✅ One shared Library
- ✅ Upload of EPUB and PDF
- ✅ Reader for EPUB and PDF
- ✅ Users can only be invited via user-specific link, which expires after X days (default: 7 days)
- ✅ No self-registration
- ✅ Edit media metadata (title, author, description, tags, media type)
- ✅ Soft delete media with 7-day recovery period
- ✅ Restore deleted media
- ✅ Automatic permanent deletion after one week
- ⏳ Conversion PDF to EPUB
- ✅ Tags for Topics
- Next.js - React framework with App Router
- NextAuth.js - Authentication with GitHub and Microsoft providers
- Prisma - Database ORM
- Neon - PostgreSQL database
- Vercel Blob - File storage for EPUBs and PDFs
- Tailwind CSS - Styling
- Node.js 18+ and npm
- A Neon PostgreSQL database
- GitHub OAuth App credentials
- Microsoft Entra ID (Azure AD) OAuth App credentials (optional)
- Vercel Blob Storage token
- Clone the repository:
git clone https://github.com/andrepetsch/secret-library.git
cd secret-library- Install dependencies:
npm install- Set up environment variables:
cp .env.example .envEdit .env and add your credentials:
DATABASE_URL: Your Neon PostgreSQL connection stringNEXTAUTH_URL: Your app URL (e.g.,http://localhost:3000for development)NEXTAUTH_SECRET: Generate withopenssl rand -base64 32GITHUB_IDandGITHUB_SECRET: From your GitHub OAuth AppMICROSOFT_ENTRA_ID_CLIENT_ID,MICROSOFT_ENTRA_ID_CLIENT_SECRET,MICROSOFT_ENTRA_ID_TENANT_ID: From Azure AD (optional)BLOB_READ_WRITE_TOKEN: Your Vercel Blob storage token- Email configuration (optional, for sending invitation emails):
EMAIL_HOST: SMTP server host (e.g.,smtp.gmail.com)EMAIL_PORT: SMTP server port (e.g.,587)EMAIL_SECURE: Set totruefor SSL/TLS (e.g.,falsefor port 587)EMAIL_USER: Your email addressEMAIL_PASS: Your email password or app-specific passwordEMAIL_FROM: Sender email address (e.g.,Secret Library <noreply@secret-library.local>)
- Set up the database:
npx prisma generate
npx prisma db push- Run the development server:
npm run devOpen http://localhost:3000 with your browser.
Since the app requires invitations, you need to manually create the first user in the database or temporarily modify the authentication logic to allow the first user to sign up.
Alternatively, create an invitation directly in the database:
INSERT INTO "Invitation" (id, token, email, "expiresAt", "createdAt", "createdBy")
VALUES (
'first-invite',
'first-user-token',
'your-email@example.com',
NOW() + INTERVAL '7 days',
NOW(),
'system'
);Then visit http://localhost:3000/invite/first-user-token and sign in.
- Sign In: Use the invitation link provided by an existing member
- Browse Library: View all uploaded books with search and filter capabilities
- Upload Books: Upload EPUB or PDF files with metadata and tags
- Read Books: Click on any book to open it in the integrated reader
- Navigation: Use arrow keys (EPUB) or buttons (PDF) to navigate through books
- Edit Media: Click "Edit" on your own media to update title, author, description, tags, or media type
- Delete Media: Click "Delete" to soft-delete media (recoverable for 7 days)
- Restore Media: Visit the "Deleted Items" page to restore deleted media within 7 days
- Automatic Cleanup: Media deleted for more than 7 days will be permanently removed automatically
- Create Invitations: Go to the Invitations page to create new invitation links
- Send Email Invitations: When email configuration is set up, invitations will be automatically sent via email
- Schedule Cleanup: Set up automated cleanup of deleted media using Vercel Cron or external services (see MEDIA_CLEANUP.md)
- Manual Sharing: If email is not configured, copy invitation links and share them manually
- Manage Invitations: View active, expired, and used invitations
secret-library/
├── prisma/
│ └── schema.prisma # Database schema
├── src/
│ ├── app/
│ │ ├── api/ # API routes
│ │ │ ├── auth/ # NextAuth endpoints
│ │ │ ├── books/ # Book management
│ │ │ └── invitations/ # Invitation management
│ │ ├── auth/ # Authentication pages
│ │ ├── invite/ # Invitation acceptance
│ │ ├── library/ # Main library view
│ │ ├── reader/ # Book reader
│ │ └── upload/ # Book upload
│ ├── components/
│ │ ├── EpubReader.tsx # EPUB reader component
│ │ └── PdfReader.tsx # PDF reader component
│ └── lib/
│ ├── auth.ts # NextAuth configuration
│ └── prisma.ts # Prisma client
└── public/
- User: User accounts with OAuth provider info
- Media: Uploaded media items (EPUB/PDF) with metadata and media type (Book, Magazine, Paper, Article)
- Tag: Topics/categories for media
- Invitation: Time-limited invitation tokens
- Account/Session: NextAuth.js tables
- Push your code to GitHub
- Import the project in Vercel
- Configure environment variables in Vercel dashboard
- Deploy
Make sure to set all the environment variables from .env.example in your Vercel project settings.
The app supports sending invitation emails automatically. To enable this feature:
-
Gmail Users:
- Use an App Password instead of your regular password
- Set
EMAIL_HOST=smtp.gmail.com,EMAIL_PORT=587,EMAIL_SECURE=false
-
Other SMTP Providers:
- Configure the SMTP settings according to your provider's documentation
- Common providers: SendGrid, Amazon SES, Mailgun, etc.
-
Optional Feature:
- Email configuration is optional
- Without email config, invitation links can still be copied and shared manually
- The app will gracefully fall back to manual link sharing if email is not configured
- Invitation-only access
- No self-registration
- Time-limited invitation links
- Secure authentication with OAuth providers
- Session-based access control
MIT
For issues or questions, please open an issue on this Repository.