Directus is an open-source headless CMS that provides a powerful and flexible interface for managing your content and databases. It allows you to create, customize, and manage your content models and data with ease, making it a great choice for building content-driven applications - supercharged with APIs.
Check Below Video from YouTube :
To quickly set up a Directus project with extension development capabilities, follow these steps:
- Clone the Repository: Clone this repository to your local machine using the following command:
git clone https://github.com/Yohita/directus-project-with-extensions-quickstart.git
- Install Dependencies: Navigate to the project directory and install the necessary dependencies using:
cd directus-project-with-extensions-quickstart npm install
-
Change patth to data.db in .env file to your file path
-
Start the Development Server: Start the development server to begin working with Directus: bash script-quickstart.sh
OR
node index.cjs
Thats it !
- Server is running on http://localhost:8055
- my-api on : http://localhost:8055/my-api
- api raw database access : http://localhost:8055/my-api/product-list-raw-dbaccess-test
- api data access using directus item service : http://localhost:8055/my-api/product-list-item-service-api-test
- Login and create a Static Access Token for the admin user.
- Copy the static token and your Directus URL. (http://localhost:8055)
- Run the following command on the terminal and follow the prompts.
$ npx directus-template-cli@latest apply
Development Mode build and run : script-quickstart.sh to prepare project and run , do this when we do any changes in extension souce bash script-quickstart.sh
Notes
- Admin Credentails Email : admin@admin.com Password : admin123
- This project uses SQLite for quickstart, but you can connect to any other database simply by configuring the .env file.
Run command : 'npx directus init' This will create .env with your mysql credentials
I work on both NodeJS scripts as well as PHP in my project , I have added little helper to help you with that in php folder It Parses and use .env file of root directory Only Supports MySql as of now.
You can use this Directus project as a foundation for building various content-driven applications. Customize your content models, create data relationships, and extend Directus to suit your specific project requirements.
For detailed information on how to use Directus, refer to the official Directus Documentation.
This project includes the tools and structure for developing extensions for Directus. You can find extension development resources and examples in the src-extensions directory. To get started with extension development, follow these steps:
Check Below Video from YouTube :
-
Create an Extension: Inside the
src-extensions/my-bundle
directory. -
Install "npm i"
-
Start with "npm run add" Follow Official Documentation Here Directus Bundle Extension
-
Develop Your Extension: Add your custom code and logic to your extension directory. You can use the provided examples as a reference.
-
Test Your Extension: Run "bash script-quickstart.sh" to build , move and start project with your extension
Treat this project as just another Node.js project and follow standard deployment procedures. No special actions are needed. Simply update your database configuration accordingly in the .env file.
VPS with a minimum of 2 GB of RAM should be sufficient to run both MySQL and the Node.js project for moderately heavy traffic.
Check Below Video from YouTube :