Welcome to PyNextjs – an advanced Python tool for creating and configuring a Next.js application effortlessly! This tool integrates several key setup steps and optional features, giving you a customizable development environment right from the start. It features a stylish interface powered by the rich
and pyfiglet
libraries to make project creation an enjoyable experience.
With PyNextjs, you can:
- 🏗️ Create a new Next.js app (in JavaScript or TypeScript)
- 🎨 Add Tailwind CSS for styling
- 📁 Generate initial pages and components to get started
- 🔒 Set up environment variables with a
.env
file - 🌍 Initialize a Git repository for version control
- 🐳 Set up Docker configuration for containerized deployment
- 📦 Install additional packages like ESLint, Prettier, and Axios
- 🌈 Enjoy a beautiful, rich interface thanks to
rich
andpyfiglet
- Python 3.6 or higher
- Node.js and npm installed
- Internet connection to install dependencies
Note: Make sure to install the required Python libraries for
rich
andpyfiglet
:pip install rich pyfiglet
-
Clone the repository:
git clone https://github.com/your-username/PyNextjs.git cd PyNextjs
-
Run the script:
python pynext.py
-
Follow the on-screen prompts to customize your Next.js project setup.
You’ll first be prompted to enter a project name for your Next.js app. This name will be used to create the project directory.
You can choose whether to use TypeScript (recommended for strongly-typed JavaScript). Simply type y
for TypeScript or n
to use JavaScript.
Tailwind CSS is an optional addition to style your project. If you choose to install it, Tailwind configuration files will be generated automatically.
The tool can create a basic index
page and an example component, which is especially useful for beginners looking to understand Next.js structure.
An optional .env
file will be created to manage environment variables. This is helpful for setting up API URLs or sensitive information like API keys.
If you choose this option, a Git repository will be initialized in the project folder, enabling version control from the start.
Opt to set up Docker configuration files, including:
- A Dockerfile for building and running your app in a containerized environment.
- A docker-compose.yml file for easy multi-service setup.
This option is helpful if you plan to deploy your Next.js app with Docker.
Choose to install:
- ESLint: Ensures code consistency.
- Prettier: Auto-formats code for readability.
- Axios: Helps with HTTP requests.
Based on your selections, PyNextjs generates the following files:
package.json
: Standard Next.js file with selected dependenciestailwind.config.js
(if Tailwind CSS is installed)Dockerfile
anddocker-compose.yml
(if Docker is selected).env.local
: Environment file with sample variables- Basic pages (
index.js/tsx
) and components (ExampleComponent.js/tsx
)
To start your Next.js app, navigate to the project folder and run:
cd project-name
npm run dev
Then, open http://localhost:3000 in your browser to see your new app in action!
Contributions are welcome! Feel free to submit a pull request or open an issue with your ideas for new features or improvements.
This project is licensed under the MIT License. See the LICENSE
file for details.
With PyNextjs, setting up a Next.js project is quick, customizable, and visually engaging. We hope you enjoy using it to streamline your development workflow! 🥳