Note
Welcome to webie.dev, this is a open-source project for building modern web.
- Framework: REMIX
- Database: MongoDB
- ORM: Prisma
- Style: tailwindcss
- UI LIbrary: shadcn/ui
- Email SDK: Resend
- Totally free without branding logos.
- You own the codebase.
- Fully modulized, take what you want and build with Typescript, HTML, JSX, and inline class (tailwindcss)
- Built-in blog system with WYSIWYG text editor.
- Optimized for performance, start with score 100, tested by PageSpeed.
- Authenticate with Email Magic Link.
- environment variable file
.env
in the root directory (/
)
You should:
- Have a useful IDE. (e.g. Visual Studio Code)
- Have a MongoDB Atlas (MongoDB's cloud service) account to host your database, every project has up to 1 free 512MB M0 cluster.
- Have a Resend account to send email.
[!INFO] You should allow all IPs, or all posible IPs, to connect to your MongoDB Atlas project when deploy, because deploying services often run various IPs. Go to your project in MongoDB Atlas Network Access > Actions > EDIT > Allow access from anywhere.
- Have either Cloudflare Turnstile, reCAPTCHA v3 (upcoming...) or hCaptcha (upcoming...) to secure your subscribe form.
- Chose where to deploy your Webie application.
If you haven't creat a .env file:
Run this in /
shell.
mv .env.sample .env
SUPER_EMAIL
: Your super admin email.DATABASE_URL
: We are using MongoDB, please replace your Username, Password, and name your Database Name.- (optional)
VITE_TURNSTILE_SITE_KEY
: This key is used to get Turnstile token in client, if you use Cloudflare Turnstile as captcha, so should be exposed in the frontend with VITE_ prefix. - (optional)
TURNSTILE_SECRET_KEY
: Used to verify Turnstile token get in the frontend in the backend AED_SECRET
: Used to encrypt your magic link for authentication flow. Runnode -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
to get one.COOKIE_SECRET
: Used to make your cookies secure. Runnode -e "console.log(require('crypto').randomBytes(64).toString('hex'))"
to get oneRESEND_API_KEY
: Send emails via Resend.BASE_URL
: This is the domain where you're hosting your Webie. e.g.BASE_URL=webie.dev
- (optional)
GOOGLE_GENERATIVE_AI_API_KEY
,OPENAI_API_KEY
,ANTHROPIC_API_KEY
: For use of Generative AI in/admin/api/ai
OBJECT_STORAGE_ACCESS_KEY_ID
,OBJECT_STORAGE_SECRET_ACCESS_KEY
,OBJECT_STORAGE_ACCOUNT_ID
: Where you save your objects, accept S3 compatible services. Using in route/admin/api/object-storage
Warning
VITE will expose any environment variable with VITE_ prefix, please use it carefully.
Run this in /
shell to install packages and
generate prisma schema for database.
npm i && npx prisma generate && npx prisma db push
For first time ever, you should set super admin email address in
.env
file, and make sure your email server has set (fill in yourRESEND_API_KEY
). Then runnpm run check-admin && npm run dev
, it will send a verification email to you. After verify, webie will create an ADMIN role user and you will seerole : "ADMIN"
in the database User table.
Run this in /
shell to start in dev mode, press q
to exit application, r
to restart.
npm run check-admin && npm run dev
If you sure have already created admin:
npm run dev
- Sign in at route
/admin
Refer to: Definitions in lib/utils
type ConventionalSuccess = {
msg: string
data?: unknown
}
type ConventionalError = {
err: string
data?: unknown
}
return json<ConventionalSuccess>({ msg: 'Action success 🎉' })
return json<ConventionalError>({ err: 'Something went wrong 🚨' })